From 16ff1423e52d6ebd174cac867ea91c10750b9389 Mon Sep 17 00:00:00 2001 From: Jan Srnicek Date: Fri, 9 Jun 2017 08:49:00 +0200 Subject: HONEYCOMB-298 - Elimination of config path leafrefs in operational tree Change-Id: I9fc035df3c90be8a5f17e4a31ff0005d88abbf28 Signed-off-by: Jan Srnicek --- .../rev170315/InterfaceNameOrIndexBuilder.java | 19 ---- .../rev170607/InterfaceNameOrIndexBuilder.java | 19 ++++ v3po/api/src/main/yang/subinterface-span.yang | 6 +- v3po/api/src/main/yang/v3po.yang | 113 +++++++++++++++------ v3po/api/src/main/yang/vpp-vlan.yang | 27 ++++- 5 files changed, 127 insertions(+), 57 deletions(-) delete mode 100644 v3po/api/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/rev170315/InterfaceNameOrIndexBuilder.java create mode 100644 v3po/api/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/rev170607/InterfaceNameOrIndexBuilder.java (limited to 'v3po/api') diff --git a/v3po/api/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/rev170315/InterfaceNameOrIndexBuilder.java b/v3po/api/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/rev170315/InterfaceNameOrIndexBuilder.java deleted file mode 100644 index bc346f6b5..000000000 --- a/v3po/api/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/rev170315/InterfaceNameOrIndexBuilder.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev170315; - - -/** - * The purpose of generated class in src/main/java for Union types is to create new instances of unions from a string representation. - * In some cases it is very difficult to automate it since there can be unions such as (uint32 - uint16), or (string - uint32). - * - * The reason behind putting it under src/main/java is: - * This class is generated in form of a stub and needs to be finished by the user. This class is generated only once to prevent - * loss of user code. - * - */ -public class InterfaceNameOrIndexBuilder { - - public static InterfaceNameOrIndex getDefaultInstance(java.lang.String defaultValue) { - return new InterfaceNameOrIndex(defaultValue); - } - -} diff --git a/v3po/api/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/rev170607/InterfaceNameOrIndexBuilder.java b/v3po/api/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/rev170607/InterfaceNameOrIndexBuilder.java new file mode 100644 index 000000000..046736742 --- /dev/null +++ b/v3po/api/src/main/java/org/opendaylight/yang/gen/v1/urn/opendaylight/params/xml/ns/yang/v3po/rev170607/InterfaceNameOrIndexBuilder.java @@ -0,0 +1,19 @@ +package org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev170607; + + +/** + * The purpose of generated class in src/main/java for Union types is to create new instances of unions from a string representation. + * In some cases it is very difficult to automate it since there can be unions such as (uint32 - uint16), or (string - uint32). + * + * The reason behind putting it under src/main/java is: + * This class is generated in form of a stub and needs to be finished by the user. This class is generated only once to prevent + * loss of user code. + * + */ +public class InterfaceNameOrIndexBuilder { + + public static InterfaceNameOrIndex getDefaultInstance(java.lang.String defaultValue) { + return new InterfaceNameOrIndex(defaultValue); + } + +} diff --git a/v3po/api/src/main/yang/subinterface-span.yang b/v3po/api/src/main/yang/subinterface-span.yang index 74d33f57c..9308c5d4a 100644 --- a/v3po/api/src/main/yang/subinterface-span.yang +++ b/v3po/api/src/main/yang/subinterface-span.yang @@ -11,6 +11,10 @@ module subinterface-span { - Src: interface |Dst: subinterface - covered by this model"; } + revision "2017-06-07" { + description "Eliminated config leafrefs in operational tree"; + } + import v3po { prefix "v3po"; } @@ -34,7 +38,7 @@ module subinterface-span { augment /if:interfaces-state/if:interface/vpp-vlan:sub-interfaces/vpp-vlan:sub-interface { ext:augment-identifier "vpp-subinterface-span-state-augmentation"; container span-state { - uses v3po:span-attributes; + uses v3po:span-state-attributes; } } } \ No newline at end of file diff --git a/v3po/api/src/main/yang/v3po.yang b/v3po/api/src/main/yang/v3po.yang index 7fc1999fa..7ef5d8876 100644 --- a/v3po/api/src/main/yang/v3po.yang +++ b/v3po/api/src/main/yang/v3po.yang @@ -22,6 +22,11 @@ module v3po { - added support for port mirroring"; } + revision "2017-06-07" { + description "Eliminated config leafrefs in operational tree"; + } + + revision "2015-01-05" { description "Initial revision of v3po model"; } @@ -465,7 +470,7 @@ module v3po { } } - grouping l2-base-attributes { + grouping l2-config-attributes { description "Parameters for configuring Layer2 features on interfaces."; @@ -474,43 +479,67 @@ module v3po { leaf xconnect-outgoing-interface { /* Don't allow selection of this interface */ must "../../if:name != current()"; - type if:interface-ref; // todo use interface-state-ref for operational data? + type if:interface-ref; description "L2 xconnect mode"; } } case bridge-based { - leaf bridge-domain { - type bridge-domain-ref; - mandatory true; - description - "Interfaces in a bridge-domain forward packets to other - interfaces in the same bridge-domain based on - destination mac address."; - } - leaf split-horizon-group { - when "../bridge-domain"; - type uint8 { - range "0..255"; - } - default 0; //no split horizon group - description - "Interface's split-horizon group. Interfaces in the same - bridge-domain and split-horizon group can not forward - packets between each other. "; - } - leaf bridged-virtual-interface { - when "../bridge-domain"; - type boolean; - default false; - description - "Interface forward packets in the bridge-domain - associated with the BVI."; - } + uses bridge-based-attributes; } } } + grouping l2-state-attributes { + description + "Parameters for configuring Layer2 features on interfaces."; + + choice interconnection { + case xconnect-based { + leaf xconnect-outgoing-interface { + /* Don't allow selection of this interface */ + must "../../if:name != current()"; + type if:interface-state-ref; + description + "L2 xconnect mode"; + } + } + case bridge-based { + uses bridge-based-attributes; + } + } + } + + grouping bridge-based-attributes { + leaf bridge-domain { + type bridge-domain-ref; + mandatory true; + description + "Interfaces in a bridge-domain forward packets to other + interfaces in the same bridge-domain based on + destination mac address."; + } + leaf split-horizon-group { + when "../bridge-domain"; + type uint8 { + range "0..255"; + } + default 0; //no split horizon group + description + "Interface's split-horizon group. Interfaces in the same + bridge-domain and split-horizon group can not forward + packets between each other. "; + } + leaf bridged-virtual-interface { + when "../bridge-domain"; + type boolean; + default false; + description + "Interface forward packets in the bridge-domain + associated with the BVI."; + } + } + grouping span-attributes { description "Parameters of the SPAN feature"; @@ -518,7 +547,7 @@ module v3po { list mirrored-interface { key "iface-ref"; leaf iface-ref { - type if:interface-ref; // todo use interface-state-ref for operational data? + type if:interface-ref; } leaf state { @@ -529,6 +558,24 @@ module v3po { } } + grouping span-state-attributes { + description "Parameters of the SPAN feature"; + + container mirrored-interfaces { + list mirrored-interface { + key "iface-ref"; + leaf iface-ref { + type if:interface-state-ref; + } + + leaf state { + type span-state; + mandatory true; + } + } + } + } + augment /if:interfaces/if:interface { ext:augment-identifier "vpp-interface-augmentation"; @@ -579,7 +626,7 @@ module v3po { "(not (../if:ipv4[if:enabled = 'true']/if:address/if:ip) and " + "not (../if:ipv6[if:enabled = 'true']/if:address/if:ip))"; - uses l2-base-attributes; + uses l2-config-attributes; } container vxlan-gpe { @@ -658,11 +705,11 @@ module v3po { "(not (../if:ipv4[if:enabled = 'true']/if:address/if:ip) and " + "not (../if:ipv6[if:enabled = 'true']/if:address/if:ip))"; - uses l2-base-attributes; + uses l2-state-attributes; } container span { - uses span-attributes; + uses span-state-attributes; } } diff --git a/v3po/api/src/main/yang/vpp-vlan.yang b/v3po/api/src/main/yang/vpp-vlan.yang index 7f8139c4a..5999a2850 100644 --- a/v3po/api/src/main/yang/vpp-vlan.yang +++ b/v3po/api/src/main/yang/vpp-vlan.yang @@ -26,6 +26,10 @@ module vpp-vlan { Reuses some concepts from draft-wilton-netmod-intf-vlan-yang-02 model."; } + revision "2017-06-07" { + description "Eliminated config leafrefs in operational tree"; + } + import ietf-interfaces { prefix "if"; } @@ -168,12 +172,25 @@ module vpp-vlan { "The match used to classify frames to this interface"; uses match-attributes; } + } - container l2 { - uses v3po:l2-base-attributes; - container rewrite { + grouping rewrite-attributes { + container rewrite { uses tag-rewrite; - } + } + } + + grouping sub-interface-l2-config-attributes { + container l2 { + uses v3po:l2-config-attributes; + uses rewrite-attributes; + } + } + + grouping sub-interface-l2-state-attributes { + container l2 { + uses v3po:l2-state-attributes; + uses rewrite-attributes; } } @@ -414,6 +431,7 @@ module vpp-vlan { uses sub-interface-ip4-attributes; uses sub-interface-ip6-attributes; uses sub-interface-routing-attributes; + uses sub-interface-l2-config-attributes; } } } @@ -435,6 +453,7 @@ module vpp-vlan { uses sub-interface-ip4-attributes; uses sub-interface-ip6-attributes; uses sub-interface-routing-attributes; + uses sub-interface-l2-state-attributes; } } } -- cgit 1.2.3-korg