-- *****************************************************************
-- FS-NTP-MIB.mib:  FS NTP MIB file
--
-- May 2009, linshuangfeng
--
-- Copyright (c) 2009 by FS.COM Inc..
-- All rights reserved.
-- 
-- *****************************************************************
--

FS-NTP-MIB DEFINITIONS ::= BEGIN

IMPORTS
        MODULE-IDENTITY,
        OBJECT-TYPE,
        IpAddress,
        Integer32
                FROM SNMPv2-SMI
        RowStatus
                FROM  SNMPv2-TC
        MODULE-COMPLIANCE,
        OBJECT-GROUP
                FROM SNMPv2-CONF
        InetAddressType,
        InetAddress
                FROM INET-ADDRESS-MIB
        fsMgmt
                FROM FS-SMI;

fsNtpMIB MODULE-IDENTITY
        LAST-UPDATED "200905140000Z"
        ORGANIZATION "FS.COM Inc.."
        CONTACT-INFO
                " 
                Tel: 400-865-2852 

                E-mail: https://www.fs.com/live_chat_service_mail.html"
        DESCRIPTION
                "This module defines fs ntp mibs."
        REVISION      "200905140000Z"
        DESCRIPTION
                "Initial version of this MIB module."
        ::= { fsMgmt 49}

fsNtpMIBObjects OBJECT IDENTIFIER ::= { fsNtpMIB 1 }
fsNtpMIBConformance OBJECT IDENTIFIER ::= { fsNtpMIB 2 }
fsntpSystem      OBJECT IDENTIFIER ::= { fsNtpMIBObjects 1 }
fsNtpMIBTrap    OBJECT IDENTIFIER  ::= { fsNtpMIBObjects 2 }
fsNtpMIBCompliances OBJECT IDENTIFIER ::= { fsNtpMIBConformance 1 }
fsNtpMIBGroups OBJECT IDENTIFIER ::= { fsNtpMIBConformance 2 }

NTPTimeStamp ::= OCTET STRING(SIZE(8))
-- TEXTUAL-CONVENTION
--  Status
--    mandatory
--  Descr
--    NTP timestamps are represented as a 64-bit
--    unsigned fixed-point number, in seconds relative to
--    00:00 on 1 January 1900.  The integer part is in the
--    first 32 bits and the fraction part is in the last
--    32 bits.
--  Refer
--    D.L. Mills, 'Network Time Protocol (Version 3)',
--        RFC-1305, March 1992, Section 3.1

NTPLeapIndicator ::= INTEGER {
        -- enum value of zero may cause problems
        noWarning(0),
        addSecond(1),
        subtractSecond(2),
        alarm(3)
        }
-- TEXTUAL-CONVENTION
--  Status
--    mandatory
--  Descr
--    This is a two-bit code warning of an impending leap
--    second to be inserted in the NTP timescale.  The bits
--    are set before 23:59 on the day of insertion and reset
--    after 00:00 on the following day.  This causes the
--    number of seconds (rollover interval) in the day of
--    insertion to be increased or decreased by one.  The two
--    bits are coded as below,
--    00, no warning
--    01, last minute has 61 seconds
--    10, last minute has 59 seconds
--    11, alarm condition (clock not synchronized)
--  Refer
--    D.L. Mills, 'Network Time Protocol(Version 3)',
--        RFC-1305, March 1992, Section 3.2.1

NTPSignedTimeValue ::= OCTET STRING(SIZE(4))
-- TEXTUAL-CONVENTION
--  Status
--    mandatory
--  Descr
--    The time in seconds that could represent signed
--    quantities like time delay with respect to some
--    source.  This textual-convention is specific to 
--    implementation of NTP where 32-bit integers are used
--    for such quantities.  The signed integer part is in
--    the first 16 bits and the fraction part is in the
--    last 16 bits.
--  Refer
--    D.L. Mills, 'Network Time Protocol (Version 3)',
--        RFC-1305, March 1992, Sections 2,  3.2.1

NTPUnsignedTimeValue ::= OCTET STRING(SIZE(4))
-- TEXTUAL-CONVENTION
--  Status
--    mandatory
--  Descr
--    The time in seconds that could represent unsigned
--    quantities like maximum error of the local clock
--    with respect to some source.  This textual-convention
--    is specific to implementation of NTP where
--    32-bit integers are used for such quantities.  The
--    unsigned integer part is in the first 16 bits and the
--    fraction part is in the last 16 bits.
--  Refer
--    D.L. Mills, 'Network Time Protocol (Version 3)',
--        RFC-1305, March 1992, Sections 2, 3.2.1

NTPStratum ::= INTEGER(0..255)
-- TEXTUAL-CONVENTION
--  Status
--    mandatory
--  Descr
--    Indicates the stratum of the clock.  The stratum
--    defines the accuracy of a time server.  Higher the
--    stratum, lower the accuracy.
--    0, unspecified
--    1, primary reference (e.g., calibrated atomic clock,
--       radio clock)
--    2-255, secondary reference (via NTP)
--  Refer
--    D.L. Mills, 'Network Time Protocol (Version 3)',
--        RFC-1305, March 1992, Section 2.2

NTPRefId ::= OCTET STRING(SIZE(4))
-- TEXTUAL-CONVENTION
--  Status
--    mandatory
--  Descr
--    The reference clock identifier.  In the case of
--    stratum 0 (unspecified) or stratum 1 (primary
--    reference source), this is a four-octet,
--    left-justified, zero-padded ASCII string as defined
--    in RFC-1305.  In the case of stratum 2 and greater
--    (secondary reference) this is the four-octet Internet
--    address of the peer selected for synchronization.
--    
--    Some examples of stratum 0 identifiers are,
--    DCN, DCN routing protocol
--    NIST, NIST public modem
--    TSP, TSP time protocol
--    DTS, Digital Time Service
--    
--    Some examples of stratum 1 identifiers are,
--    ATOM, Atomic clock (calibrated)
--    VLF, VLF radio (OMEGA,, etc.)
--    LORC, LORAN-C radionavigation
--    GOES, GOES UHF environment satellite
--    GPS, GPS UHF satellite positioning
--  Refer
--    D.L. Mills, Network Time Protocol (Version 3)',
--        RFC-1305, March 1992, Section 3.2.1

fsntpSysLeap OBJECT-TYPE
    SYNTAX NTPLeapIndicator
--    Rsyntax INTEGER {
--        enum value of zero may cause problems
--        noWarning(0),
--        addSecond(1),
--        subtractSecond(2),
--        alarm(3)
--        }
    MAX-ACCESS read-write
    STATUS current
    DESCRIPTION
        "Two-bit code warning of an impending leap second to
        be inserted in the NTP timescale. This object can be
        set only when the fsntpSysStratum has a value of 1."
    ::= { fsntpSystem 1 }

fsntpSysStratum OBJECT-TYPE
    SYNTAX NTPStratum
--    Rsyntax INTEGER(0..255)
    MAX-ACCESS read-write
    STATUS current
    DESCRIPTION
        "The stratum of the local clock. If the value is set
        to 1, i.e., this is a primary reference, then the
        Primary-Clock procedure described in Section 3.4.6,
        in RFC-1305 is invoked."
    ::= { fsntpSystem 2 }

fsntpSysPrecision OBJECT-TYPE
    SYNTAX INTEGER(-24..24)
    MAX-ACCESS read-only
    STATUS current
    DESCRIPTION
        "Signed integer indicating the precision
        of the system clock, in seconds to the nearest
        power of two.  The value must be rounded to the
        next larger power of two; for instance, a 50-Hz
        (20 ms) or 60-Hz (16.67 ms) power-frequency clock
        would be assigned the value -5 (31.25 ms), while a
        1000-Hz (1 ms) crystal-controlled clock would be
        assigned the value -9 (1.95 ms)."
    ::= { fsntpSystem 3 }

fsntpSysRootDelay OBJECT-TYPE
    SYNTAX NTPSignedTimeValue
--    Rsyntax OCTET STRING(SIZE(4))
--  Units
--    seconds
    MAX-ACCESS read-only
    STATUS current
    DESCRIPTION
        "A signed fixed-point number indicating the total
        round-trip delay in seconds, to the primary reference
        source at the root of the synchronization subnet."
    REFERENCE
        "D.L. Mills, 'Network Time Protocol (Version 3)',
            RFC-1305, March 1992, Sections 2.2, 3.2.1"
    ::= { fsntpSystem 4 }

fsntpSysRootDispersion OBJECT-TYPE
    SYNTAX NTPUnsignedTimeValue
--    Rsyntax OCTET STRING(SIZE(4))
--  Units
--    seconds
    MAX-ACCESS read-only
    STATUS current
    DESCRIPTION
        "The maximum error in seconds, relative to the
        primary reference source at the root of the
        synchronization subnet.  Only positive values greater
        than zero are possible."
    REFERENCE
        "D.L. Mills, 'Network Time Protocol (Version 3)',
            RFC-1305, March 1992, Sections 2, 2.2, 3.2.1"
    ::= { fsntpSystem 5 }

fsntpSysRefId OBJECT-TYPE
    SYNTAX NTPRefId
--    Rsyntax OCTET STRING(SIZE(4))
    MAX-ACCESS read-only
    STATUS current
    DESCRIPTION
        "The reference identifier of the local clock."
    ::= { fsntpSystem 6 }

fsntpSysRefTime OBJECT-TYPE
    SYNTAX NTPTimeStamp
--    Rsyntax OCTET STRING(SIZE(8))
    MAX-ACCESS read-only
    STATUS current
    DESCRIPTION
        "The local time when the local clock was last
        updated.  If the local clock has never been
        synchronized, the value is zero."
    ::= { fsntpSystem 7 }

fsNTPServerIPAdd OBJECT-TYPE
    SYNTAX IpAddress
    MAX-ACCESS read-write
    STATUS current
    DESCRIPTION
        "NTP Server address."
    ::= { fsntpSystem 8 }

fsTimeAfterNTPCal OBJECT-TYPE
    SYNTAX OCTET STRING(SIZE(8))
    MAX-ACCESS read-only
    STATUS current
    DESCRIPTION
        "Time After NTP Call."
    ::= { fsntpSystem 9 }

fsTimeSyncPeriod OBJECT-TYPE
    SYNTAX Integer32(0..8640000)
    MAX-ACCESS read-write
    STATUS current
    DESCRIPTION
        "Time Sync Period."
    ::= { fsntpSystem 10 }    

-- ntp server table
fsNtpServerTable OBJECT-TYPE
    SYNTAX SEQUENCE OF FSNtpServerEntry
    MAX-ACCESS not-accessible
    STATUS current
    DESCRIPTION
        "The table about NTP server infomation."
    ::= { fsntpSystem 11 } 

fsNtpServerEntry OBJECT-TYPE
    SYNTAX FSNtpServerEntry
    MAX-ACCESS not-accessible
    STATUS current
    DESCRIPTION
        "The entry of fsNtpServerTable."
    INDEX { 
        fsNtpServerNetType,
        fsNtpServerNetAddr
    }
    ::= { fsNtpServerTable 1 }

FSNtpServerEntry ::=
    SEQUENCE {
        fsNtpServerNetType    InetAddressType,
        fsNtpServerNetAddr    InetAddress,
        fsNtpServerVersion    INTEGER,
        fsNtpServerStatus     RowStatus
    }

fsNtpServerNetType  OBJECT-TYPE
    SYNTAX InetAddressType
    MAX-ACCESS read-only           
    STATUS current               
    DESCRIPTION               
        "Address type of NTP server:
         ipv4(1),
         ipv6(2)"           
    ::= { fsNtpServerEntry 1 }   

fsNtpServerNetAddr OBJECT-TYPE
    SYNTAX InetAddress               
    MAX-ACCESS read-only             
    STATUS current 
    DESCRIPTION
        "Address of NTP server."               
    ::= { fsNtpServerEntry 2 } 

fsNtpServerVersion OBJECT-TYPE
    SYNTAX INTEGER {
         version1(1),
         version2(2),
         version3(3)
    }       
    MAX-ACCESS read-create            
    STATUS current             
    DESCRIPTION               
        "Version of NTP server."
    ::= { fsNtpServerEntry 3 } 

fsNtpServerStatus OBJECT-TYPE               
    SYNTAX RowStatus               
    MAX-ACCESS read-create           
    STATUS current          
    DESCRIPTION
        "RowStatus of NTP server."
    ::= { fsNtpServerEntry 4 } 

fsntpSysState OBJECT-TYPE
    SYNTAX      INTEGER
        {
            unsynchronized(0),
            synchronized(1)
        }
    MAX-ACCESS  read-only
    STATUS      current
    DESCRIPTION
        "This is a integer indicating the state of local clock."
    ::= { fsntpSystem 12 }

-- ntp trap
fsNtpStatussyncTrap       NOTIFICATION-TYPE
    OBJECTS {
        fsntpSysState
    }
    STATUS  current
    DESCRIPTION
        "This trap is sent when the ntp state is changed"
    ::= { fsNtpMIBTrap 1 }  

-- compliance statements
fsNtpSysGroup OBJECT-GROUP
          OBJECTS {
          fsntpSysLeap, 
          fsntpSysStratum, 
          fsntpSysPrecision,
          fsntpSysRootDelay, 
          fsntpSysRootDispersion, 
          fsntpSysRefId,
          fsntpSysRefTime,
          fsNTPServerIPAdd,
          fsTimeAfterNTPCal,
          fsTimeSyncPeriod,
          fsNtpServerNetType,
          fsNtpServerNetAddr,
          fsNtpServerVersion,
          fsNtpServerStatus,
          fsntpSysState
        }
        STATUS  current
        DESCRIPTION
                "The NTP system variables."
        ::= { fsNtpMIBGroups 1 }

fsNtpMIBCompliance MODULE-COMPLIANCE
        STATUS  current
        DESCRIPTION
                "The compliance statement for agents which implement the NTP MIB."
        MODULE  -- this module
                MANDATORY-GROUPS { fsNtpMIBGroups
                 }
        ::= { fsNtpMIBCompliances 1 }

END

