-- Copyright (c) 2024 BE Networks, Inc.  All rights reserved.

-- *****************************************************************
-- BE-NETWORKS-CONFIG-MIB: MIB for Configuring to/from switch's
-- running-config startup-config
-- *****************************************************************

BE-NETWORKS-CONFIG-MIB DEFINITIONS ::= BEGIN

IMPORTS
    MODULE-COMPLIANCE, 
    OBJECT-GROUP                                FROM SNMPv2-CONF
    MODULE-IDENTITY, OBJECT-TYPE, Unsigned32    FROM SNMPv2-SMI
    TEXTUAL-CONVENTION, DateAndTime, RowStatus  FROM SNMPv2-TC
    iPhoiVNManagement                           FROM IPHOTONIX-SMI-MIB;

benetworksConfigMIB MODULE-IDENTITY
    LAST-UPDATED    "202405130000Z"
    ORGANIZATION "Be-Networks, Inc."
    CONTACT-INFO
        "Be-Networks, Inc.
         Postal: Suite 950 Tower 2600 
                 Richardson, TX, USA
         E-mail: mounire.elhoumaidi@be-net.com"
    DESCRIPTION "This MIB is for appling a configuration defined in source URI .
                 A URI specifies the location of a local file, network file,
                 running-config or startup-config. The resources specified by
                 the URIs are copied from/to be-net managed devices."
    REVISION    "202405130000Z"
    DESCRIPTION "The initial revision of this MIB module."
    ::= { iPhoiVNManagement 6 }

ConfigState ::= TEXTUAL-CONVENTION
    STATUS          current
    DESCRIPTION     "The state of a Config request. Here are the possible states:
                    inactive:   no Config request has been queued yet. This is
                                the default state when a row is created.
                    scheduled:  the Config request has been scheduled to run, but
                                has not started yet (probably waiting for ealier
                                Config requests to complete).
                    running:    the Config request has been started.
                    completed:  the Config request is completed with success.
                    failed:     the Config request failed (probably because network
                                problem, timeout, permission denial, etc.)
                    Once the row is activated, the agent will mark the row as
                    scheduled. It changes state to running when the Config request
                    is started. Once the Config request is completed, the state
                    changes to completed or failed."
    SYNTAX          INTEGER  {
                        inactive(0),
                        scheduled(1),
                        running(2),
                        completed(3),
                        failed(4)
                    }

ConfigCommand ::= TEXTUAL-CONVENTION
    STATUS          current
    DESCRIPTION     "The Config request type. Here are the possible states:

                    set_full:   Apply Full Config request based on URI 
                    This is the default state when a row is created
                    set_partial: Apply Partial Config request based on URI
                    get: Retrieve Config and provide URI."
    SYNTAX          INTEGER  {
                        setFull(0),
                        setPartial(1),
                        get(2)
                    }                    

ConfigFailureCause ::= TEXTUAL-CONVENTION
    STATUS          current
    DESCRIPTION     "The reason why a Config request failed. Possible causes are:
                    none:       the Config request succeeded.
                    unknown:    the Config request failed without a clear
                                cause, details are in the failure message.
                    timeout:    the Config request took too long and has been
                                terminated."
    SYNTAX          INTEGER  {
                        none(0),
                        unknown(1),
                        timeout(2)
                    }

benetworksConfigCommandTable OBJECT-TYPE
    SYNTAX          SEQUENCE OF benetworksConfigCommandEntry
    MAX-ACCESS      not-accessible
    STATUS          current
    DESCRIPTION     "A table of Config requests. Each row corresponds to a Config
                    request. The completed rows are accessible for status
                    retrival for a certain peroid of time and then will be
                    gradually aged out by the agent."
    ::= { benetworksConfigMIB 1 }

benetworksConfigCommandEntry OBJECT-TYPE
    SYNTAX          benetworksConfigCommandEntry
    MAX-ACCESS      not-accessible
    STATUS          current
    DESCRIPTION     "A config Command.
                    
                    Once a config request is setup correctly with URI, it 
                    can be queued by setting the row status to active. 
                    The row creation, config request setup and row activation 
                    can be done in one or multiple SET requests.

                    The status of the config request may change after the request
                    is queued. It can be retrieved at any time before the request
                    is aged out by the agent.
                    "
    INDEX { benetworksConfigId }
    ::= { benetworksConfigCommandTable 1 }

benetworksConfigCommandEntry ::=
    SEQUENCE {
        benetworksConfigId              Unsigned32,
        benetworksConfigReq             ConfigCommand,
        benetworksConfigUri             OCTET STRING,
        benetworksConfigOptions         OCTET STRING,        
        benetworksConfigState           ConfigState,
        benetworksConfigTimeStarted     DateAndTime,
        benetworksConfigTimeCompleted   DateAndTime,
        benetworksConfigFailureCause    ConfigFailureCause,
        benetworksConfigFailureMessage  OCTET STRING,
        benetworksConfigRowStatus       RowStatus
}

benetworksConfigId OBJECT-TYPE
    SYNTAX     Unsigned32
    MAX-ACCESS     not-accessible
    STATUS          current
    DESCRIPTION     "The ID of a config request."
    ::= { benetworksConfigCommandEntry 1 }

benetworksConfigReq OBJECT-TYPE
    SYNTAX          ConfigCommand
    MAX-ACCESS      read-create
    STATUS          current
    DESCRIPTION     "The config request type set_full(0), set_partial(1), get(2)"
    ::= { benetworksConfigCommandEntry 2 }
    
benetworksConfigUri OBJECT-TYPE
    SYNTAX          OCTET STRING
    MAX-ACCESS      read-create
    STATUS          current
    DESCRIPTION     "URI of a config command "
    ::= { benetworksConfigCommandEntry 3 }
   
benetworksConfigOptions OBJECT-TYPE
    SYNTAX          OCTET STRING
    MAX-ACCESS      read-create
    STATUS          current
    DESCRIPTION     "The config request options"
    ::= { benetworksConfigCommandEntry 4 }
    
benetworksConfigState OBJECT-TYPE
    SYNTAX          ConfigState
    MAX-ACCESS      read-only
    STATUS          current
    DESCRIPTION     "The state of a Config request."
    ::= { benetworksConfigCommandEntry 5 }

benetworksConfigTimeStarted OBJECT-TYPE
    SYNTAX          DateAndTime
    MAX-ACCESS      read-only
    STATUS          current
    DESCRIPTION     "The time when a Config request was started."
    ::= { benetworksConfigCommandEntry 6 }

benetworksConfigTimeCompleted OBJECT-TYPE
    SYNTAX          DateAndTime 
    MAX-ACCESS      read-only
    STATUS          current
    DESCRIPTION     "The time when a Config request was completed."
    ::= { benetworksConfigCommandEntry 7 }

benetworksConfigFailureCause OBJECT-TYPE
    SYNTAX          ConfigFailureCause
    MAX-ACCESS      read-only
    STATUS          current
    DESCRIPTION     "The cause of a failed Config request."
    ::= { benetworksConfigCommandEntry 8 }

benetworksConfigFailureMessage OBJECT-TYPE
    SYNTAX          OCTET STRING (SIZE (0..65535))
    MAX-ACCESS      read-only
    STATUS          current
    DESCRIPTION     "The details of a failed Config request."
    ::= { benetworksConfigCommandEntry 9 }

benetworksConfigRowStatus OBJECT-TYPE
    SYNTAX          RowStatus
    MAX-ACCESS      read-create
    STATUS          current
    DESCRIPTION     "The row status of a Config request.

                    A new Config request is instantiated by creating a new row.
                    An existing Config request is queued by activating a row, or
                    cancelled by destroying a row."
    ::= { benetworksConfigCommandEntry 10 }

-- Conformance

benetworksConfigConformance OBJECT IDENTIFIER ::= { benetworksConfigMIB 2 }

benetworksConfigCompliances OBJECT IDENTIFIER ::= { benetworksConfigConformance 1 }
benetworksConfigGroups      OBJECT IDENTIFIER ::= { benetworksConfigConformance 2 }

-- Units of conformance

benetworksConfigCompliance MODULE-COMPLIANCE
    STATUS          current
    DESCRIPTION     "The compliance statement for SNMP entities which implement
                    the BENETWORKS-CONFIG-MIB."
    MODULE
        MANDATORY-GROUPS {
            benetworksConfigObjectsGroup
        }
    ::= { benetworksConfigCompliances 1 }

benetworksConfigObjectsGroup    OBJECT-GROUP
    OBJECTS {
        benetworksConfigReq,
        benetworksConfigUri,
        benetworksConfigState,
        benetworksConfigTimeStarted,
        benetworksConfigTimeCompleted,
        benetworksConfigFailureCause,
        benetworksConfigFailureMessage,
        benetworksConfigRowStatus
    }
    STATUS          current
    DESCRIPTION     "The collection of objects in the BENETWORKS-CONFIG-MIB."
    ::= { benetworksConfigGroups 1 }
END
