With my limited knowledge of SNMP MIB constructs and such, I kindly ask for help in understanding how to approach my problem.
I have today a working solution for configuring an IPv4 address and Port in one object using this:
TransportAddressIPv4 ::= TEXTUAL-CONVENTION
DISPLAY-HINT "1d.1d.1d.1d:2d"
STATUS current
DESCRIPTION
"Represents a transport address consisting of an IPv4
address and a port number (as used for example by UDP,
TCP and SCTP):
octets contents encoding
1-4 IPv4 address network-byte order
5-6 port number network-byte order
This textual convention SHOULD NOT be used directly in object
definitions since it restricts addresses to a specific format.
However, if it is used, it MAY be used either on its own or
**in conjunction with TransportAddressType** or TransportDomain
**as a pair.**"
SYNTAX OCTET STRING (SIZE (6))
Now I need to extend this object to also include IPv6 and Dns as choices and the description of TransportAddressIPv4 implies that there should be a way to combine it with TransportAddressType as a pair. How would that be done? I can’t find anything in any RFC nor elsewhere that does this.
Some clarification; I have this object, which is limited to IPv4 addresses.
myAddress OBJECT-TYPE
SYNTAX TransportAddressIPv4
MAX-ACCESS read-write
STATUS current
DESCRIPTION
"IPv4 address and Port.
"
::= { myObject 2 }
…and now I’d like to replace TransportAddressIPv4 in this object with a pair, using TransportAddressType in some way. I suppose that it would be going together with the general definition TransportAddress (I also don’t know how to do that), but how could I also include the specific TransportAddressIPv4, TransportAddressIPv6 and TransportAddressDns as choices in order to benefit from e.g. the DISPLAY-HINTs in those TEXTUAL-CONVENTIONs?
bmk
Unfortunately compilation of the SEQUENCE example fails:
% rebar3 compile
===> Verifying dependencies...
===> Analyzing applications...
MY-MIB.mib: 709: Undefined type ''MyTransport''
[MY-MIB.mib:731][WAR]: Unexpected SEQUENCE 'MyTransport' => ignoring
I suppose I could use that construction if I just can get it to compile, but in any case I’d prefer a solution using CHOICE. I have also not been able to find any examples with the CHOICE construct. Anyone…?