From 815f6da443f7032704908aa21f232bd05e89acb6 Mon Sep 17 00:00:00 2001 From: Marek Gradzki Date: Mon, 30 May 2016 14:51:14 +0200 Subject: Implementation of the new vlan model. Missing features that will be added in subsequent commits: - initializers update - unit test update - postman collection update Change-Id: Iff01f6f9b4347261a504fe1a1d7840060cae367f Signed-off-by: Marek Gradzki --- .../dot1q/tag/or/any/Dot1qTagVlanIdBuilder.java | 10 ++++- v3po/api/src/main/yang/v3po.yang | 43 ++++++++++++---------- v3po/api/src/main/yang/vpp-vlan.yang | 40 ++++++++++++++++++++ 3 files changed, 73 insertions(+), 20 deletions(-) (limited to 'v3po/api') diff --git a/v3po/api/src/main/java/org/opendaylight/yang/gen/v1/urn/ieee/params/xml/ns/yang/dot1q/types/rev150626/dot1q/tag/or/any/Dot1qTagVlanIdBuilder.java b/v3po/api/src/main/java/org/opendaylight/yang/gen/v1/urn/ieee/params/xml/ns/yang/dot1q/types/rev150626/dot1q/tag/or/any/Dot1qTagVlanIdBuilder.java index 0efe2807d..e9304e291 100644 --- a/v3po/api/src/main/java/org/opendaylight/yang/gen/v1/urn/ieee/params/xml/ns/yang/dot1q/types/rev150626/dot1q/tag/or/any/Dot1qTagVlanIdBuilder.java +++ b/v3po/api/src/main/java/org/opendaylight/yang/gen/v1/urn/ieee/params/xml/ns/yang/dot1q/types/rev150626/dot1q/tag/or/any/Dot1qTagVlanIdBuilder.java @@ -1,4 +1,6 @@ package org.opendaylight.yang.gen.v1.urn.ieee.params.xml.ns.yang.dot1q.types.rev150626.dot1q.tag.or.any; + +import org.opendaylight.yang.gen.v1.urn.ieee.params.xml.ns.yang.dot1q.types.rev150626.Dot1qVlanId; import org.opendaylight.yang.gen.v1.urn.ieee.params.xml.ns.yang.dot1q.types.rev150626.dot1q.tag.or.any.Dot1qTag.VlanId; @@ -13,8 +15,14 @@ import org.opendaylight.yang.gen.v1.urn.ieee.params.xml.ns.yang.dot1q.types.rev1 */ public class Dot1qTagVlanIdBuilder { + private final static String ANY = "any"; + public static VlanId getDefaultInstance(java.lang.String defaultValue) { - throw new java.lang.UnsupportedOperationException("Not yet implemented"); + if (ANY.equals(defaultValue)) { + return new VlanId(VlanId.Enumeration.Any); + } else { + return new VlanId(new Dot1qVlanId(Integer.valueOf(defaultValue))); + } } } diff --git a/v3po/api/src/main/yang/v3po.yang b/v3po/api/src/main/yang/v3po.yang index 86a2764b8..18b82a9b0 100644 --- a/v3po/api/src/main/yang/v3po.yang +++ b/v3po/api/src/main/yang/v3po.yang @@ -42,15 +42,16 @@ module v3po { "This type is used by to reference a bridged virtual interface"; } - typedef vlan-type { + // todo remove from v3po + /*typedef vlan-type { type enumeration { enum 802dot1q; enum 802dot1ad; } - } + }*/ // todo remove from v3po - typedef tag-rewrite-operation { + /*typedef tag-rewrite-operation { type enumeration { enum disabled; enum push-1; @@ -62,13 +63,14 @@ module v3po { enum translate-2-to-1; enum translate-2-to-2; } - } + }*/ - typedef vlan-tag { - type uint16 { - range "1..4094"; - } - } + // todo remove from v3po + //typedef vlan-tag { + // type uint16 { + // range "1..4094"; + // } + //} identity vxlan-tunnel { base if:interface-type; @@ -151,7 +153,7 @@ module v3po { } // todo remove from v3po - grouping sub-interface-base-attributes { + /*grouping sub-interface-base-attributes { leaf identifier { type uint32; } @@ -183,7 +185,7 @@ module v3po { leaf default-subif { type empty; } - } + }*/ grouping tap-interface-base-attributes { leaf tap-name { @@ -307,7 +309,8 @@ module v3po { } } - grouping vlan-tag-rewrite-attributes { + // todo remove from v3po + /* grouping vlan-tag-rewrite-attributes { leaf rewrite-operation { type tag-rewrite-operation; default 'disabled'; @@ -322,7 +325,7 @@ module v3po { leaf tag2 { type vlan-tag; } - } + }*/ grouping l2-base-attributes { description @@ -377,13 +380,14 @@ module v3po { // 2. Only this augmentation with combination of ifc type is trigger to do something for vpp, what if user only configures base interface stuff ? + We need to get leaves defined by ietf-interfaces when we are processing this augment // 3. The ietf-interfaces model does not define groupings which makes types reuse difficult + /* container sub-interface { when "../if:type = 'v3po:sub-interface'"; leaf super-interface { type if:interface-ref; } uses sub-interface-base-attributes; - } + }*/ container tap { when "../if:type = 'v3po:tap'"; @@ -419,9 +423,9 @@ module v3po { uses l2-base-attributes; - container vlan-tag-rewrite { + /*container vlan-tag-rewrite { uses vlan-tag-rewrite-attributes; - } + }*/ } container vxlan-gpe { @@ -475,13 +479,14 @@ module v3po { type string; } + /* container sub-interface { when "../if:type = 'v3po:sub-interface'"; leaf super-interface { type if:interface-state-ref; } uses sub-interface-base-attributes; - } + }*/ container tap { when "../if:type = 'v3po:tap'"; @@ -516,9 +521,9 @@ module v3po { uses l2-base-attributes; - container vlan-tag-rewrite { + /* container vlan-tag-rewrite { uses vlan-tag-rewrite-attributes; - } + }*/ } } diff --git a/v3po/api/src/main/yang/vpp-vlan.yang b/v3po/api/src/main/yang/vpp-vlan.yang index d4e3b64af..fdf878b75 100644 --- a/v3po/api/src/main/yang/vpp-vlan.yang +++ b/v3po/api/src/main/yang/vpp-vlan.yang @@ -32,6 +32,35 @@ module vpp-vlan { } } + // todo add 802dot1ad support to dot1q-types.yang + /* + * Defines the supported IEEE 802.1Q types that can be used for + * VLAN tag matching. + */ + identity vlan-type { + description "Base identity from which all VLAN types + are derived from"; + } + + identity 802dot1q { + base vlan-type; + description + "An 802.1Q VLAN type"; + } + + identity 802dot1ad { + base vlan-type; + description + "An 802.1ad VLAN type"; + } + + typedef vlan-type { + type identityref { + base "vlan-type"; + } + description "Identifies a specific VLAN type"; + } + grouping match-attributes { choice match-type { mandatory true; @@ -78,6 +107,11 @@ module vpp-vlan { // TODO VPP does not allow to change subinterface nor delete it (except for tag-rewrite operation) grouping sub-interface-base-attributes { + leaf vlan-type { + type vlan-type; + default 802dot1q; + } + container tags { list tag { key "index"; @@ -164,6 +198,12 @@ module vpp-vlan { */ grouping tag-rewrite { description "Flexible rewrite"; + + leaf vlan-type { // todo rename to push_dot1q, mandatory(?) with default true + type vlan-type; + default 802dot1q; + } + leaf pop-tags { type uint8 { range 1..2; -- cgit 1.2.3-korg