-- *****************************************************************
-- MY-INTERFACE-MIB.mib:  My interface MIB file
--
-- $Copyright$
-- 
-- *****************************************************************
--

MY-INTERFACE-MIB DEFINITIONS ::= BEGIN

IMPORTS
        MODULE-IDENTITY,
        OBJECT-TYPE,
        NOTIFICATION-TYPE,
        Integer32,
        Counter32,
        IpAddress
                FROM SNMPv2-SMI
        VlanId
                FROM Q-BRIDGE-MIB
        TruthValue,
        DisplayString,
        RowStatus,
        MacAddress
                FROM SNMPv2-TC
        MODULE-COMPLIANCE,
        OBJECT-GROUP,
        NOTIFICATION-GROUP
                FROM SNMPv2-CONF
        ConfigStatus,
        MemberMap,
        IfIndex
                FROM MY-TC
        EnabledStatus 
                FROM P-BRIDGE-MIB
        myMgmt
                FROM MY-SMI;

myInterfaceMIB MODULE-IDENTITY
        LAST-UPDATED "200203200000Z"
        ORGANIZATION "$Company$"
        CONTACT-INFO
                " 
                Tel: $Telephone$ 

                E-mail: $E-mail$"
        DESCRIPTION
                "This module defines my interface mibs."
        REVISION      "200203200000Z"
        DESCRIPTION
                "Initial version of this MIB module."
        ::= { myMgmt 10}

myIfConfigMIBObjects OBJECT IDENTIFIER ::= { myInterfaceMIB 1 }


myIfTable OBJECT-TYPE
        SYNTAX SEQUENCE OF MyIfEntry
        MAX-ACCESS not-accessible
        STATUS current
        DESCRIPTION
            "list of interface basic configuration objects."
        ::= { myIfConfigMIBObjects 1 }
    
myIfEntry OBJECT-TYPE
        SYNTAX MyIfEntry
        MAX-ACCESS not-accessible
        STATUS current
        DESCRIPTION
            "Entry contains interface basic configurations."
        INDEX { myIfIndex }
        ::= { myIfTable 1 }

MyIfEntry ::=
        SEQUENCE {
            myIfIndex IfIndex,
            myIfPortType INTEGER,
            myIfFlowControlAdminStatus INTEGER,
            myIfFlowControlOperStatus EnabledStatus,
            myIfAdminSpeed INTEGER,
            myIfAdminDuplex INTEGER,
            myIfOperSpeed INTEGER,
            myIfOperDuplex INTEGER,
            myIfManageStatus EnabledStatus,
            myIfIpBroadcast  IpAddress,            
            myIfLayer INTEGER,
            myIfMode  INTEGER,
            myIfCounterClear Integer32,
            myIfEntryStatus ConfigStatus,
            myIfMediumType INTEGER
        }

myIfIndex OBJECT-TYPE
        SYNTAX IfIndex
        MAX-ACCESS read-only
        STATUS current
        DESCRIPTION
            " "
        ::= { myIfEntry 1 }

myIfPortType OBJECT-TYPE
        SYNTAX INTEGER {
            unknown(1),
            port10M100MBASETX(2),
            port100MBASEFXL(3),        
            port100MBASEFXS(4),
            port1000MBASESX(5),   
            port1000MBASELX(6),
            port1000MBASETX(7),
            portGBIC(8),
            port100MBASEFX(9),
            port1000MBASEFX(10),
            portSFP(11),
			port10GBASESR(12),
			port10GBASELR(13),
			port10GBASEER(14),
			port10GBASELX4(15),
			port10GBASESW(16),
			port10GBASELW(17),
			port10GBASEEW(18),
			port10GBASE(19)
         }
        MAX-ACCESS read-only
        STATUS current
        DESCRIPTION
            "Port type of this port, list as above.
             port100MBASEFX indicates that port is port100MBASEFXL or port100MBASEFXS,
             and system doesn't distinguish.
             port1000MBASEFX indicates that port is port1000MBASEFLX or port1000MBASEFSX,
             and system doesn't distinguish.
             
             This attribute apply physical port"
        ::= { myIfEntry 2 }
           
myIfFlowControlAdminStatus OBJECT-TYPE
        SYNTAX INTEGER {
            enabled(1),
            disabled(2),
            autonego(3),
            unknown(4)
        }
        MAX-ACCESS read-write
        STATUS current
        DESCRIPTION
            "Flow control of a port management status.
            
            This attribute apply physical port and aggreate port"
        ::= { myIfEntry 3 }
    
myIfFlowControlOperStatus OBJECT-TYPE
        SYNTAX EnabledStatus
        MAX-ACCESS read-only
        STATUS current
        DESCRIPTION
            "Oper status: after the negotiation between two ports connetted 
            the flow contrl status.
            
            This attribute apply physical port and aggreate port"
        ::= { myIfEntry 4 }
                     
myIfAdminSpeed OBJECT-TYPE
        SYNTAX INTEGER {
            speed10Mb(1),
            speed100Mb(2),
            speed1000Mb(3),
            autonego(4),
            speed10Gb(5),
            unknown(6)
        }
        MAX-ACCESS read-write
        STATUS current
        DESCRIPTION
            "port speed settings.
            
            This attribute apply physical port and aggreate port"
        ::= { myIfEntry 5 }
        
myIfAdminDuplex OBJECT-TYPE
        SYNTAX INTEGER {
            full(1),
            half(2),
            autonego(3),
            unknown(4)
        }
        MAX-ACCESS read-write
        STATUS current
        DESCRIPTION
            "port duplex settings.
            
            This attribute apply physical port and aggreate port"
        ::= { myIfEntry 6 }        
    
myIfOperSpeed OBJECT-TYPE
        SYNTAX INTEGER {
            speed10Mb(1),
            speed100Mb(2),
            speed1000Mb(3),
            unknown(4),
            speed10Gb(5)
        }
        MAX-ACCESS read-only
        STATUS current
        DESCRIPTION
            "After two port have negotiated the speed status,and this object 
            is the working speed status. while the port link status is down ,
            then the speed status is unknown(4).
            
            This attribute apply physical port and aggreate port"
        ::= { myIfEntry 7 }

myIfOperDuplex OBJECT-TYPE
        SYNTAX INTEGER {
            full(1),
            half(2),
            unknown(3)
        }
        MAX-ACCESS read-only
        STATUS current
        DESCRIPTION
            "After two port have negotiated the duplex status, and this object 
            is the working duplex status. while the port link status is down ,
            then the speed status is unknown(3).
            
            This attribute apply physical port and aggreate port"
        ::= { myIfEntry 8 }

myIfManageStatus OBJECT-TYPE
        SYNTAX EnabledStatus 
        MAX-ACCESS read-write
        STATUS current
        DESCRIPTION 
                "Management status of the interface."
        DEFVAL { enabled }
        ::={myIfEntry 9}

myIfIpBroadcast OBJECT-TYPE
    SYNTAX IpAddress
    MAX-ACCESS read-write
    STATUS current
    DESCRIPTION
        "Broadcast address of the interface. if broadcast address not configured on interface, return 0.0.0.0"
       ::= { myIfEntry 10 }
                      

myIfLayer OBJECT-TYPE
        SYNTAX  INTEGER {
                  layer-2(1), -- the interface is a interface of L2
                  layer-3(2)  -- the interface is a interface of L3
              }
        MAX-ACCESS  read-write
        STATUS  current
        DESCRIPTION
              ""
        ::= { myIfEntry 11 }
        
myIfMode OBJECT-TYPE
        SYNTAX  INTEGER {
            access(1), -- the mode of interface is access port
            trunk(2),  -- the mode of interface is trunk port
            dot1q-tunnel(3),   -- the mode of interface is 802.1q tunnel port
            hybrid(4), -- the mode of interface is hybrid port
		  		  other(5), -- other mode 
		  		  uplink(6), -- the mode of interface is uplink port
		  		  host(7), -- the mode of interface is private-vlan host port
		  		  promiscuous(8) -- the mode of interface is private-vlan promiscuous port
              }
        MAX-ACCESS  read-write
        STATUS  current
        DESCRIPTION
              "This value is meaning for only physical port and aggreate port"
        ::= { myIfEntry 12 }

myIfCounterClear OBJECT-TYPE
        SYNTAX Integer32
        MAX-ACCESS read-write
        STATUS current
        DESCRIPTION
            "Setting its to any value but 0, will clear counters of this interface. 
             Setting its value to 0 will cause no action of the agent. and when
             query will always return 0.            "
        ::= { myIfEntry 13 } 
        
myIfEntryStatus OBJECT-TYPE
        SYNTAX ConfigStatus
        MAX-ACCESS read-create
        STATUS current
        DESCRIPTION
            "Status of this entry, set this object to valid will create a interface, 
             and set its value to invalid will delete the interface of this entry."
        ::= { myIfEntry 14 }
                       
myIfMediumType OBJECT-TYPE
        SYNTAX INTEGER {
            unknown(0),
            copper(1),
            fiber(2)
         }
        MAX-ACCESS read-write
        STATUS current
        DESCRIPTION
            "Port medium type of this port,fiber or copper."
        ::= { myIfEntry 15 }
                       
myIfIpTable OBJECT-TYPE
       SYNTAX      SEQUENCE OF MyIfIpEntry
       MAX-ACCESS  not-accessible
       STATUS      current
       DESCRIPTION
               "A list of interface ip configuration entries."
       ::= { myIfConfigMIBObjects 2}

myIfIpEntry OBJECT-TYPE
       SYNTAX      MyIfIpEntry
       MAX-ACCESS  not-accessible
       STATUS      current
       DESCRIPTION
               "An entry containing configuration information applicable
               to a Layer3 interface."
       INDEX   { myIfIpIfIndex, myIfIpId, myIfIp}
       ::= { myIfIpTable 1 }

MyIfIpEntry ::=
       SEQUENCE {
          myIfIpIfIndex         IfIndex,
          myIfIpId              INTEGER,
          myIfIp                IpAddress,
          myIfIpMask            IpAddress,
          myIfIpEntryStatus     RowStatus
        }
myIfIpIfIndex OBJECT-TYPE
       SYNTAX      IfIndex
       MAX-ACCESS  read-only
       STATUS      current
       DESCRIPTION
               "A unique value, for each Layer3 interface."
       ::= { myIfIpEntry 1 }       
       
myIfIpId OBJECT-TYPE
       SYNTAX      INTEGER{
                       primary(1),    -- primary ip address of Layer3 interface
                       secondary(2)   -- secondary ip address of Layer3 interface
                   }
       MAX-ACCESS  read-only
       STATUS      current
       DESCRIPTION
               "Type of interface ip address."
       ::= { myIfIpEntry 2 }              

myIfIp OBJECT-TYPE
        SYNTAX IpAddress
        MAX-ACCESS read-only
        STATUS current
        DESCRIPTION
            "Ip address of the interface myIfIndex refer to."
        ::= { myIfIpEntry 3 }       
        
myIfIpMask OBJECT-TYPE
        SYNTAX IpAddress
        MAX-ACCESS read-write
        STATUS current
        DESCRIPTION
            "Ip mask of the interface ip address."
        ::= { myIfIpEntry 4 }       
            
myIfIpEntryStatus OBJECT-TYPE
        SYNTAX RowStatus
        MAX-ACCESS read-create
        STATUS current
        DESCRIPTION
            "entry status of this entry. and the means in this enviraments can
            reffer to the text-convention definition of the RowStatus."
        ::= { myIfIpEntry 5 } 


myIfStatusTable OBJECT-TYPE
        SYNTAX SEQUENCE OF MyIfStatusEntry
        MAX-ACCESS not-accessible
        STATUS current
        DESCRIPTION
            "list of interface status. Status information include some error state and
             result of examining to the interface,etc."
        ::= { myIfConfigMIBObjects 3 }
    
myIfStatusEntry OBJECT-TYPE
        SYNTAX MyIfStatusEntry
        MAX-ACCESS not-accessible
        STATUS current
        DESCRIPTION
            "Entry contains interface status information."
        INDEX { myIfStatusIndex }
        ::= { myIfStatusTable 1 }

MyIfStatusEntry ::=
        SEQUENCE {
            myIfStatusIndex IfIndex,
            myIfStatusLoopBackExamine Integer32,
            myIfErrorStatus           INTEGER,
            myIfLineDetect            Integer32
        }

myIfStatusIndex OBJECT-TYPE
        SYNTAX IfIndex
        MAX-ACCESS read-only
        STATUS current
        DESCRIPTION
            " "
        ::= { myIfStatusEntry 1 }

myIfStatusLoopBackExamine OBJECT-TYPE
        SYNTAX Integer32
        MAX-ACCESS read-write
        STATUS current
        DESCRIPTION
            "Setting its to any value but 0, will Checking whether this port or aggreate can
              receive and send packets normally, It indicates that port or aggreate is normal
              if opertion is success. 
                  Setting its value to 0 will cause no action of the agent. and when
             query will always return 0.
            
            This attribute apply physical port and aggreate port"
        ::= { myIfStatusEntry  2 } 
        
myIfErrorStatus OBJECT-TYPE
        SYNTAX INTEGER {
            no-error(1),               -- port is enabled normal
            err-disable-bpduguard(2),  -- port is disabled by port receive BPDU packet when port
                                       -- enable BPDU guard             
            err-disable-ptsecurity(3)  -- port is disabled by port security is violatd
        }
        MAX-ACCESS read-only
        STATUS current
        DESCRIPTION
            "Port's error status information"
        ::= { myIfStatusEntry 3 }
           
           
myIfLineDetect OBJECT-TYPE
        SYNTAX Integer32
        MAX-ACCESS read-only
        STATUS current
        DESCRIPTION
            "When reading this object, system detects the quality of line connecting the port.
             Detect whether the line is broken or short circuit or not. 
             
             The meaning of the obtained value:
             Return value=N*10000000+M
             N stands for the line state (0: perfect; 1: break; 2: short circuit)
             M stands for the location of the break or short circuit in the line(distance from the switch port, in metre)
             If the line is perfect, the value is zero."
        ::= { myIfStatusEntry  4 }
           
myGlobalIfDisableRecovery OBJECT-TYPE
        SYNTAX Integer32
        MAX-ACCESS read-write
        STATUS current
        DESCRIPTION
            "Setting its to any value but 0, the interfaces  which is shutted down by
             some error happened will recovery from disabled status . 
                  Setting its value to 0 will cause no action of the agent. and when
             query will always return 0.
            
            This attribute apply physical port and aggreate port"
        ::= { myIfConfigMIBObjects  4 } 
                               
--
-- portType Choose
--
myPortTypeChooseTable OBJECT-TYPE
        SYNTAX SEQUENCE OF MyPortTypeChooseEntry
        MAX-ACCESS not-accessible
        STATUS current
        DESCRIPTION
            "Table of entrance to choose port type." 
        ::= { myIfConfigMIBObjects 5 }
    
myPortTypeChooseEntry OBJECT-TYPE
        SYNTAX MyPortTypeChooseEntry
        MAX-ACCESS not-accessible
        STATUS current
        DESCRIPTION
            "Entrance to choose port type."  
        INDEX { myPortTypeChooseIndex }
        ::= { myPortTypeChooseTable 1 }

MyPortTypeChooseEntry ::=
        SEQUENCE {
            myPortTypeChooseIndex IfIndex,
      	    myPortTypeChooseType INTEGER
        }

myPortTypeChooseIndex OBJECT-TYPE
        SYNTAX IfIndex
        MAX-ACCESS read-only
        STATUS current
        DESCRIPTION
            "The logic port number." 
        ::= { myPortTypeChooseEntry 1 }

myPortTypeChooseType OBJECT-TYPE
        SYNTAX INTEGER {
		fiber(1),       --priority of fiber port
      		copper(2)       --priority of copper port
        }
        MAX-ACCESS read-only
        STATUS current
        DESCRIPTION
            "The chosen port type. This object is used to choose one of the multiple physical ports of different types,
            when the same logical port is correspondent with them.
            Apply this attribute to the physical port only." 
        ::= { myPortTypeChooseEntry 2 }

--
-- mtu
--
myIfMTUTable OBJECT-TYPE
        SYNTAX SEQUENCE OF MyIfMTUEntry
        MAX-ACCESS not-accessible
        STATUS current
        DESCRIPTION
            "Access table of MTU on interface." 
        ::= { myIfConfigMIBObjects 6 }
    
myIfMTUEntry OBJECT-TYPE
        SYNTAX MyIfMTUEntry
        MAX-ACCESS not-accessible
        STATUS current
        DESCRIPTION
            "Interfac MTU access." 
        INDEX { myIfMTUIndex }
        ::= { myIfMTUTable 1 }

MyIfMTUEntry ::=
        SEQUENCE {
            myIfMTUIndex IfIndex,
      	    myIfMTU Integer32
        }

myIfMTUIndex OBJECT-TYPE
        SYNTAX IfIndex
        MAX-ACCESS read-only
        STATUS current
        DESCRIPTION
            "Interface number"
        ::= { myIfMTUEntry 1 }

myIfMTU OBJECT-TYPE
        SYNTAX Integer32
        MAX-ACCESS read-write
        STATUS current
        DESCRIPTION
            "Interface MTU."
        ::= { myIfMTUEntry 2 }
--
-- Available Bandwidth
--
myIfAvailableBWTable OBJECT-TYPE
        SYNTAX SEQUENCE OF MyIfAvailableBWEntry
        MAX-ACCESS not-accessible
        STATUS current
        DESCRIPTION
            "Access table of Available Bandwidth on interface." 
        ::= { myIfConfigMIBObjects 7 }
    
myIfAvailableBWEntry OBJECT-TYPE
        SYNTAX MyIfAvailableBWEntry
        MAX-ACCESS not-accessible
        STATUS current
        DESCRIPTION
            "Interfac available bandwidth access." 
        INDEX { myIfAvailableBWIfIndex }
        ::= { myIfAvailableBWTable 1 }

MyIfAvailableBWEntry ::=
        SEQUENCE {
            myIfAvailableBWIfIndex IfIndex,
      	    myIfAvailableBWIfBW Gauge
        }

myIfAvailableBWIfIndex OBJECT-TYPE
        SYNTAX IfIndex
        MAX-ACCESS read-only
        STATUS current
        DESCRIPTION
            "Interface number"
        ::= { myIfAvailableBWEntry 1 }

myIfAvailableBWIfBW OBJECT-TYPE
        SYNTAX Gauge
        MAX-ACCESS read-only
        STATUS current
        DESCRIPTION
            "Interface available bandwidth(bit)."
        ::= { myIfAvailableBWEntry 2 }
        

-- Notification
myInterfaceTraps      OBJECT IDENTIFIER ::= { myInterfaceMIB 2 }
                                 
lineDetectStatus OBJECT-TYPE
        SYNTAX INTEGER{
            ok(1),       --line has restored to normal state 
            open(2),     --a break in the line 
            short(3)     --short circuit in the line             
        }
        MAX-ACCESS accessible-for-notify
        STATUS current
        DESCRIPTION
          "The type of storm of interface"
        ::= { myInterfaceTraps 1 }
        
lineDetectPosition OBJECT-TYPE
        SYNTAX Integer32
        MAX-ACCESS accessible-for-notify
        STATUS current
        DESCRIPTION
          "Location where the break or short circuit in the line happens
           (Distance from the switch port, in metre.)" 
        ::= { myInterfaceTraps 2 }        
        
lineQualityDetect NOTIFICATION-TYPE
    OBJECTS {ifIndex, lineDetectStatus,lineDetectPosition}
    STATUS  current
    DESCRIPTION
            "The notification of discovering a break or short circuit in the line,
             or restoring the line to the normal state." 
    ::= { myInterfaceTraps 3 }        
                                     
myInterfaceMIBConformance OBJECT IDENTIFIER ::= { myInterfaceMIB 3 }
myInterfaceMIBCompliances OBJECT IDENTIFIER ::= { myInterfaceMIBConformance 1 }
myInterfaceMIBGroups      OBJECT IDENTIFIER ::= { myInterfaceMIBConformance 2 }


-- compliance statements

myInterfaceMIBCompliance MODULE-COMPLIANCE
        STATUS  current
        DESCRIPTION
                "The compliance statement for entities which implement
                the My Interface MIB"
        MODULE  -- this module
                MANDATORY-GROUPS { myInterfaceMIBGroup
                 }

				GROUP myPortTypeChooseMibGroup
				DESCRIPTION  
                     "This group is mandatory when system supports optional port type."  

				GROUP myIfMTUMibGroup
				DESCRIPTION  
                     "This group is mandatory when system supports MTU setting."  

				GROUP myIfLineDetectGroup
				DESCRIPTION  
                     "This group is mandatory when system supports line quality detection."                  
                     
				GROUP myIfAvailableBWMibGroup
				DESCRIPTION  
                     "This group is mandatory when system supports available bandwidth getting."                   
        ::= { myInterfaceMIBCompliances 1 }
                
-- units of conformance

myInterfaceMIBGroup OBJECT-GROUP
        OBJECTS {
            myIfIndex,
            myIfPortType,
            myIfFlowControlAdminStatus,
            myIfFlowControlOperStatus,
            myIfAdminSpeed,
            myIfAdminDuplex,
            myIfOperSpeed,
            myIfOperDuplex,
            myIfManageStatus,
            myIfIpBroadcast,
            myIfLayer,
            myIfMode,
            myIfCounterClear,
            myIfEntryStatus,
            myIfMediumType,
            myIfIpIfIndex,
            myIfIpId,
            myIfIp,
            myIfIpMask,
            myIfIpEntryStatus,
            myIfStatusIndex,
            myIfStatusLoopBackExamine,
            myIfErrorStatus,
            myGlobalIfDisableRecovery
        }
        STATUS  current
        DESCRIPTION
                "A collection of objects providing interface basic configure ."
        ::= { myInterfaceMIBGroups 1 }         
                
myPortTypeChooseMibGroup OBJECT-GROUP
        OBJECTS {
            myPortTypeChooseIndex,
            myPortTypeChooseType
        }
        STATUS  current
        DESCRIPTION
                "Information collection of choosing port type." 
        ::= { myInterfaceMIBGroups 2 }         
                

myIfMTUMibGroup OBJECT-GROUP
        OBJECTS {
            myIfMTUIndex,
            myIfMTU
        }
        STATUS  current
        DESCRIPTION
                "Interface MTU information collection." 
        ::= { myInterfaceMIBGroups 3 }  
                            
myIfLineDetectGroup OBJECT-GROUP
        OBJECTS {
            myIfLineDetect
        }
        STATUS  current
        DESCRIPTION
                "Information collection of line quality detection." 
        ::= { myInterfaceMIBGroups 4 }           
                
myIfAvailableBWMibGroup OBJECT-GROUP
        OBJECTS {
            myIfAvailableBWIfIndex,
      	    myIfAvailableBWIfBW
        }
        STATUS  current
        DESCRIPTION
                "Interface available bandwidth information collection." 
        ::= { myInterfaceMIBGroups 5 }   
        
END
