Subject: [netmod] YANG-types for Multicast Addresses

From: "Markus Rothmann -X (mrothman - Universitaet der Bundeswehr Muenchen at Cisco)" <[email-masked]>
Date: Wed, 13 Jun 2012 17:48:11 -0700

Hello,

in the process of defining a YANG module for IP-multicast, I have
written some types based on the "IP-address"-types in the
ietf-inet-types module ("urn:ietf:params:xml:ns:yang:ietf-inet-types").
They further restrict the patterns used to match the ranges 224/4 and
ff00::/8 for IP-multicast and 232/8 and FF3x::/32 for source-specific
multicast. Are these types of more general interest?
Are there suggestions where those definitions should be added?
 
Regards,

__________

Markus Rothmann, B.Sc.

University of the German Federal Armed Forces Munich

Cisco NOSTG Architecture, SJ-23

 

       typedef IP-Multicast-Group-Address {

             description "The IP-Multicast-Group-Address type represents
an IP multicast address and is IP version neutral. The format of the
textual representations implies the IP version.";

             type union {

                    type IPv4-Multicast-Group-Address;

                    type IPv6-Multicast-Group-Address;

             }            

       } // typedef IP-Multicast-Group-Address

       typedef IPv4-Multicast-Group-Address {

             description "The IPv4-Multicast-Group-Address type
represents an IPv4 multicast address in dotted-quad notation.";

             reference "RFC4607";

             type string {

                    pattern
'(2((2[4-9])|(3[0-9]))\.)(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0
-5])\.){2}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])';

             }

       } // typedef IPv4-Multicast-Group-Address

       typedef IPv6-Multicast-Group-Address {

             description "The IPv6-Multicast-Group-Address type
represents an IPv6 address in full, mixed, shortened, and
shortened-mixed notation.";

             reference "RFC4291 2.7.

                              ietf-inet-types:ipv6-address";

             type string {

                    pattern

'(((FF|ff)[0-9a-fA-F]{2}):)([0-9a-fA-F]{0,4}:){0,5}((([0-9a-fA-F]{0,4}:)
?(:|[0-9a-fA-F]{0,4}))|(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\.){3}(25
[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))';

                    pattern

'(([^:]+:){6}(([^:]+:[^:]+)|(.*\..*)))|((([^:]+:)*[^:]+)?::(([^:]+:)*[^:
]+)?)';

              }

       } // typedef IPv6-Multicast-Group-Address

 

       typedef IP-Multicast-Group-Address-Prefix {

             description "The IP-Multicast-Group-Address-Prefix type
represents an IP multicast address prefix and is IP version neutral. The
format of the textual representations implies the IP version. It
includes a prefix-length, separated by a '/' sign.";

             type union {

                    type IPv4-Multicast-Group-Address-Prefix;

                    type IPv6-Multicast-Group-Address-Prefix;

             }            

       } // typedef IP-Multicast-Group-Address-Prefix

       typedef IPv4-Multicast-Group-Address-Prefix {

             description "The IPv4-Multicast-Group-Address-Prefix type
represents an IPv4 multicast address prefix in dotted-quad notation. It
includes a prefix-length, separated by a '/' sign.";

             reference "RFC4607";

             type string {

                    pattern
'(2((2[4-9])|(3[0-9]))\.)(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0
-5])\.){2}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])(/(([4-9])|(
[1-2][0-9])|(3[0-2])))';

             }

       } // typedef IPv4-Multicast-Group-Address-Prefix

       typedef IPv6-Multicast-Group-Address-Prefix {

             description "The IPv6-Multicast-Group-Address-Prefix type
represents an IPv6 multicast address prefix in full, mixed, shortened,
and shortened-mixed notation. It includes a prefix-length, separated by
a '/' sign.";

             reference "RFC4291 2.7.

                              ietf-inet-types:ipv6-address";

             type string {

                    pattern

'(((FF|ff)[0-9a-fA-F]{2}):)([0-9a-fA-F]{0,4}:){0,5}((([0-9a-fA-F]{0,4}:)
?(:|[0-9a-fA-F]{0,4}))|(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\.){3}(25
[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))(/((1[6-9])|([2-9][0-9])|(1[0-1][0-
9])|(12[0-8])))';

                    pattern

'(([^:]+:){6}(([^:]+:[^:]+)|(.*\..*)))|((([^:]+:)*[^:]+)?::(([^:]+:)*[^:
]+)?)(/.+)';

             }

       } // typedef IPv6-Multicast-Group-Address-Prefix

 

       typedef IP-SSM-Group-Address {

             description "The IP-SSM-Group-Address type represents an IP
source-specific multicast address and is IP version neutral. The format
of the textual representations implies the IP version.";

             type union {

                    type IPv4-SSM-Group-Address;

                    type IPv6-SSM-Group-Address;

             }

       } // typedef IP-SSM-Group-Address

       typedef IPv4-SSM-Group-Address {

             description "The IPv4-SSM-Group-Address type represents an
IPv4 source-specific multicast address in dotted-quad notation.

                                  IPv4 addresses in the 232/8 range are
designated as SSM.";

             reference "RFC4607

                                 IANA IPv4 Multicast Address Space
Registry";

             type string {

                    pattern
'(232\.)(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){2}([0-9]|
[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])';

             }

       } // typedef IPv4-SSM-Group-Address

       typedef IPv6-SSM-Group-Address {

             description  "The IPv6-SSM-Group-Address type represents an
IPv6 source-specific multicast group address in shortened and
shortened-mixed notation.";

             reference "RFC4607";

             type string {

                    pattern

'((FF3|ff3)([0-9a-fA-F]{1}):)([0-9a-fA-F]{0,4}:){0,5}((([0-9a-fA-F]{0,4}
:)?(:|[0-9a-fA-F]{0,4}))|(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\.){3}(
25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))';

                    pattern

'(([^:]+:){6}(([^:]+:[^:]+)|(.*\..*)))|((([^:]+:)*[^:]+)?::(([^:]+:)*[^:
]+)?)';

             }

       } // typedef IPv6-SSM-Group-Address