Model converter: unit test with l3vpn yang files: model data to resource data.
Change-Id: I5e208af0a8ad47082d3d7f1f552662b33ec1143d
diff --git a/model/src/main/java/org/onosproject/yang/model/AtomicPath.java b/model/src/main/java/org/onosproject/yang/model/AtomicPath.java
index fe53e22..12debd7 100644
--- a/model/src/main/java/org/onosproject/yang/model/AtomicPath.java
+++ b/model/src/main/java/org/onosproject/yang/model/AtomicPath.java
@@ -16,6 +16,11 @@
package org.onosproject.yang.model;
+import java.util.Objects;
+
+import static com.google.common.base.MoreObjects.toStringHelper;
+import static java.util.Objects.hash;
+
/**
* Abstraction of an entity which identifies a generated class uniquely among
* its siblings.
@@ -50,4 +55,25 @@
public void type(DataNode.Type type) {
this.type = type;
}
+
+ @Override
+ public int hashCode() {
+ return hash(type);
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == null) {
+ return false;
+ }
+ AtomicPath that = (AtomicPath) obj;
+ return Objects.equals(type, that.type);
+ }
+
+ @Override
+ public String toString() {
+ return toStringHelper(getClass())
+ .add("type", type)
+ .toString();
+ }
}
diff --git a/runtime/src/main/java/org/onosproject/yang/runtime/impl/DefaultDataTreeBuilder.java b/runtime/src/main/java/org/onosproject/yang/runtime/impl/DefaultDataTreeBuilder.java
index c78e54e..0b25e83 100644
--- a/runtime/src/main/java/org/onosproject/yang/runtime/impl/DefaultDataTreeBuilder.java
+++ b/runtime/src/main/java/org/onosproject/yang/runtime/impl/DefaultDataTreeBuilder.java
@@ -254,6 +254,11 @@
String name = obj.getClass().getName();
YangNode child = parent.getChild();
while (child != null) {
+
+ if (child.getYangSchemaNodeType() == YANG_NON_DATA_NODE) {
+ child = child.getNextSibling();
+ continue;
+ }
//search if parent node has choice as child node.
if (child instanceof YangChoice) {
output = findFromChoiceNode(name, parent);
@@ -261,8 +266,6 @@
} else if (child instanceof YangCase) {
output = findFromCaseNode(name, parent);
//no need to process non data nodes.
- } else if (child.getYangSchemaNodeType() == YANG_NON_DATA_NODE) {
- continue;
} else {
//search for normal nodes.
output = getNode(child, name);
diff --git a/runtime/src/main/java/org/onosproject/yang/runtime/impl/ModelConverterUtil.java b/runtime/src/main/java/org/onosproject/yang/runtime/impl/ModelConverterUtil.java
index 11e50d7..f579168 100644
--- a/runtime/src/main/java/org/onosproject/yang/runtime/impl/ModelConverterUtil.java
+++ b/runtime/src/main/java/org/onosproject/yang/runtime/impl/ModelConverterUtil.java
@@ -365,8 +365,8 @@
Class<?> idClass;
try {
idClass = classLoader.loadClass(idPkg);
- Method method = idClass.getDeclaredMethod(methodName, (Class<?>) null);
- return String.valueOf(method.invoke(fieldObj, (Object) null)).trim();
+ Method method = idClass.getDeclaredMethod(methodName);
+ return String.valueOf(method.invoke(fieldObj)).trim();
} catch (ClassNotFoundException | NoSuchMethodException |
InvocationTargetException | IllegalAccessException e) {
throw new ModelConvertorException(e);
diff --git a/runtime/src/test/java/org/onosproject/yang/runtime/impl/L3vpnModelConverterTest.java b/runtime/src/test/java/org/onosproject/yang/runtime/impl/L3vpnModelConverterTest.java
new file mode 100644
index 0000000..967c941
--- /dev/null
+++ b/runtime/src/test/java/org/onosproject/yang/runtime/impl/L3vpnModelConverterTest.java
@@ -0,0 +1,1139 @@
+/*
+ * Copyright 2017-present Open Networking Laboratory
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.onosproject.yang.runtime.impl;
+
+import org.junit.Test;
+import org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.l3vpn.svc.rev20160730.ietfl3vpnsvc.AddressAllocationType;
+import org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.l3vpn.svc.rev20160730.ietfl3vpnsvc.DefaultL3VpnSvc;
+import org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.l3vpn.svc.rev20160730.ietfl3vpnsvc.RoutingProtocolType;
+import org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.l3vpn.svc.rev20160730.ietfl3vpnsvc.SiteNetworkAccessType;
+import org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.l3vpn.svc.rev20160730.ietfl3vpnsvc.SiteRole;
+import org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.l3vpn.svc.rev20160730.ietfl3vpnsvc.SvcId;
+import org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.l3vpn.svc.rev20160730.ietfl3vpnsvc.accessvpnpolicy.DefaultVpnAttachment;
+import org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.l3vpn.svc.rev20160730.ietfl3vpnsvc.accessvpnpolicy.vpnattachment.attachmentflavor.DefaultVpnId;
+import org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.l3vpn.svc.rev20160730.ietfl3vpnsvc.l3vpnsvc.DefaultSites;
+import org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.l3vpn.svc.rev20160730.ietfl3vpnsvc.l3vpnsvc.DefaultVpnServices;
+import org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.l3vpn.svc.rev20160730.ietfl3vpnsvc.l3vpnsvc.sites.DefaultSite;
+import org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.l3vpn.svc.rev20160730.ietfl3vpnsvc.l3vpnsvc.sites.SiteKeys;
+import org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.l3vpn.svc.rev20160730.ietfl3vpnsvc.l3vpnsvc.sites.site.DefaultSiteNetworkAccesses;
+import org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.l3vpn.svc.rev20160730.ietfl3vpnsvc.l3vpnsvc.sites.site.sitenetworkaccesses.DefaultSiteNetworkAccess;
+import org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.l3vpn.svc.rev20160730.ietfl3vpnsvc.l3vpnsvc.vpnservices.DefaultVpnSvc;
+import org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.l3vpn.svc.rev20160730.ietfl3vpnsvc.siteattachmentbearer.DefaultBearer;
+import org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.l3vpn.svc.rev20160730.ietfl3vpnsvc.siteattachmentbearer.bearer.DefaultRequestedType;
+import org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.l3vpn.svc.rev20160730.ietfl3vpnsvc.siteattachmentipconnection.DefaultIpConnection;
+import org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.l3vpn.svc.rev20160730.ietfl3vpnsvc.siteattachmentipconnection.ipconnection.DefaultIpv4;
+import org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.l3vpn.svc.rev20160730.ietfl3vpnsvc.siteattachmentipconnection.ipconnection.ipv4.DefaultAddresses;
+import org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.l3vpn.svc.rev20160730.ietfl3vpnsvc.siterouting.DefaultRoutingProtocols;
+import org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.l3vpn.svc.rev20160730.ietfl3vpnsvc.siterouting.routingprotocols.DefaultRoutingProtocol;
+import org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.l3vpn.svc.rev20160730.ietfl3vpnsvc.siterouting.routingprotocols.routingprotocol.DefaultBgp;
+import org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.l3vpn.svc.ext.rev20160730.l3vpnsvcext.bearerattachmentgrouping.DefaultBearerAttachment;
+import org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.l3vpn.svc.ext.rev20160730.l3vpnsvcext.l3vpnsvc.sites.site.sitenetworkaccesses.sitenetworkaccess.bearer.DefaultAugmentedL3VpnBearer;
+import org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.l3vpn.svc.ext.rev20160730.l3vpnsvcext.l3vpnsvc.sites.site.sitenetworkaccesses.sitenetworkaccess.bearer.requestedtype.DefaultAugmentedL3VpnRequestedType;
+import org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.l3vpn.svc.ext.rev20160730.l3vpnsvcext.requestedtypegrouping.DefaultRequestedTypeProfile;
+import org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.l3vpn.svc.ext.rev20160730.l3vpnsvcext.requestedtypegrouping.requestedtypeprofile.requestedtypechoice.DefaultPhysicalCase;
+import org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.l3vpn.svc.ext.rev20160730.l3vpnsvcext.requestedtypegrouping.requestedtypeprofile.requestedtypechoice.physicalcase.DefaultPhysical;
+import org.onosproject.yang.gen.v1.urn.ietf.params.xml.ns.yang.yrt.ietf.inet.types.rev20130715.yrtietfinettypes.Ipv4Address;
+import org.onosproject.yang.model.DataNode;
+import org.onosproject.yang.model.DefaultModelObjectData;
+import org.onosproject.yang.model.InnerNode;
+import org.onosproject.yang.model.KeyLeaf;
+import org.onosproject.yang.model.ListKey;
+import org.onosproject.yang.model.ModelObject;
+import org.onosproject.yang.model.ModelObjectId;
+import org.onosproject.yang.model.NodeKey;
+import org.onosproject.yang.model.ResourceData;
+import org.onosproject.yang.model.ResourceId;
+import org.onosproject.yang.model.SchemaId;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.Is.is;
+import static org.onosproject.yang.model.DataNode.Type.MULTI_INSTANCE_NODE;
+import static org.onosproject.yang.model.DataNode.Type.SINGLE_INSTANCE_LEAF_VALUE_NODE;
+import static org.onosproject.yang.model.DataNode.Type.SINGLE_INSTANCE_NODE;
+import static org.onosproject.yang.runtime.impl.TestUtils.validateDataNode;
+
+/**
+ * Unit test for l3vpn app. test for conversion of model data to resource data.
+ */
+public class L3vpnModelConverterTest {
+
+ private ResourceData rscData;
+ private DefaultDataTreeBuilder treeBuilder;
+ private ResourceId id;
+ private List<NodeKey> keys;
+ private SchemaId sid;
+ private List<DataNode> dataNodes;
+ private DataNode node;
+ private DefaultModelObjectData.Builder data;
+ private final TestYangSchemaNodeProvider schemaProvider = new
+ TestYangSchemaNodeProvider();
+ private static final String NAME_SPACE_SVC =
+ "urn:ietf:params:xml:ns:yang:ietf-l3vpn-svc";
+ private static final String NAME_SPACE_EXT =
+ "urn:ietf:params:xml:ns:yang:l3vpn:svc:ext";
+
+ /**
+ * Do the prior setup for each UT.
+ */
+ private void setUp() {
+ schemaProvider.processSchemaRegistry();
+ DefaultYangModelRegistry registry = schemaProvider.registry();
+ treeBuilder = new DefaultDataTreeBuilder(registry);
+ }
+
+ /**
+ * Unit test for empty model id and container object of l3vpn-svc.
+ */
+ @Test
+ public void emptyModelId() {
+ setUp();
+ data = new DefaultModelObjectData.Builder();
+ data.addModelObject(l3VpnObject());
+ rscData = treeBuilder.getResourceData(data.build());
+
+ id = rscData.resourceId();
+ keys = id.nodeKeys();
+ assertThat(1, is(keys.size()));
+
+ sid = keys.get(0).schemaId();
+ assertThat("/", is(sid.name()));
+ assertThat(null, is(sid.namespace()));
+
+ dataNodes = rscData.dataNodes();
+ assertThat(1, is(dataNodes.size()));
+
+ node = dataNodes.get(0);
+
+ validateDataNode(node, "l3vpn-svc", NAME_SPACE_SVC,
+ SINGLE_INSTANCE_NODE,
+ true, null);
+
+ //validate l3vpn-svc 's child nodes.
+ //first validate vpn-services.
+ Map<NodeKey, DataNode> childMap = ((InnerNode) node).childNodes();
+ assertThat(2, is(childMap.size()));
+
+ Iterator<Map.Entry<NodeKey, DataNode>> it = childMap.entrySet().iterator();
+ Map.Entry<NodeKey, DataNode> n = it.next();
+
+ validateDataNode(n.getValue(), "vpn-services", NAME_SPACE_SVC,
+ SINGLE_INSTANCE_NODE,
+ true, null);
+
+ childMap = ((InnerNode) n.getValue()).childNodes();
+ assertThat(1, is(childMap.size()));
+ it = childMap.entrySet().iterator();
+ n = it.next();
+
+ validateDataNode(n.getValue(), "vpn-svc", NAME_SPACE_SVC,
+ MULTI_INSTANCE_NODE, true, null);
+
+ node = dataNodes.get(0);
+
+ //validate l3vpn-svc 's child nodes.
+ //now validate site network access.
+ childMap = ((InnerNode) node).childNodes();
+
+ it = childMap.entrySet().iterator();
+ n = it.next();
+ n = it.next();
+
+ //container sites.
+ validateDataNode(n.getValue(), "sites", NAME_SPACE_SVC,
+ SINGLE_INSTANCE_NODE,
+ true, null);
+
+ childMap = ((InnerNode) n.getValue()).childNodes();
+ assertThat(1, is(childMap.size()));
+ it = childMap.entrySet().iterator();
+ n = it.next();
+
+ //list site
+ validateDataNode(n.getValue(), "site", NAME_SPACE_SVC,
+ MULTI_INSTANCE_NODE, true, null);
+
+ childMap = ((InnerNode) n.getValue()).childNodes();
+ assertThat(2, is(childMap.size()));
+ it = childMap.entrySet().iterator();
+ n = it.next();
+
+ //leaf site-id
+ validateDataNode(n.getValue(), "site-id", NAME_SPACE_SVC,
+ SINGLE_INSTANCE_LEAF_VALUE_NODE, true, "first-site");
+
+ //container site network access
+ n = it.next();
+ validateDataNode(n.getValue(), "site-network-accesses", NAME_SPACE_SVC,
+ SINGLE_INSTANCE_NODE, true, null);
+
+ childMap = ((InnerNode) n.getValue()).childNodes();
+ assertThat(1, is(childMap.size()));
+ it = childMap.entrySet().iterator();
+ n = it.next();
+
+ //list site network access.
+ validateDataNode(n.getValue(), "site-network-access", NAME_SPACE_SVC,
+ MULTI_INSTANCE_NODE, true, null);
+
+ childMap = ((InnerNode) n.getValue()).childNodes();
+ assertThat(6, is(childMap.size()));
+ it = childMap.entrySet().iterator();
+ n = it.next();
+
+ //leaf site network access id.
+ validateDataNode(n.getValue(), "site-network-access-id", NAME_SPACE_SVC,
+ SINGLE_INSTANCE_LEAF_VALUE_NODE, true,
+ "first-site-network-access-id");
+
+ n = it.next();
+ //leaf site network access type.
+ validateDataNode(n.getValue(), "site-network-access-type", NAME_SPACE_SVC,
+ SINGLE_INSTANCE_LEAF_VALUE_NODE, true,
+ "site-network-access-type");
+
+ n = it.next();
+ //grouping container bearer with augments.
+ validateDataNode(n.getValue(), "bearer", NAME_SPACE_SVC,
+ SINGLE_INSTANCE_NODE, true,
+ null);
+
+ //validate child nodes of bearer.
+ validateBearer(n.getValue());
+
+ n = it.next();
+ //container ip connection form grouping.
+ validateDataNode(n.getValue(), "ip-connection", NAME_SPACE_SVC,
+ SINGLE_INSTANCE_NODE, true,
+ null);
+
+ //validate ip connections's child node.
+ validateIpConnections(n.getValue());
+
+ n = it.next();
+ //container routing protocols form grouping.
+ validateDataNode(n.getValue(), "routing-protocols", NAME_SPACE_SVC,
+ SINGLE_INSTANCE_NODE, true,
+ null);
+
+ //validate child nodes of routing protocols
+ validateRoutingProtocols(n.getValue());
+
+ n = it.next();
+ //container vpn attachment form grouping.
+ validateDataNode(n.getValue(), "vpn-attachment", NAME_SPACE_SVC,
+ SINGLE_INSTANCE_NODE, true,
+ null);
+
+ //validate child node of vpn attachments.
+ validateVpnAttachments(n.getValue());
+ }
+
+ /**
+ * Unit test for model id with l3vpn-svc and container object of
+ * vpn services.
+ */
+ @Test
+ public void modelIdForVpnServices() {
+ setUp();
+ data = new DefaultModelObjectData.Builder();
+ data.addModelObject((ModelObject) l3VpnObject().vpnServices());
+ data.identifier(ModelObjectId.builder().addChild(DefaultL3VpnSvc.class)
+ .build());
+ rscData = treeBuilder.getResourceData(data.build());
+
+ id = rscData.resourceId();
+ keys = id.nodeKeys();
+ assertThat(2, is(keys.size()));
+
+ sid = keys.get(0).schemaId();
+ assertThat("/", is(sid.name()));
+ assertThat(null, is(sid.namespace()));
+
+ sid = keys.get(1).schemaId();
+ assertThat("l3vpn-svc", is(sid.name()));
+ assertThat(NAME_SPACE_SVC, is(sid.namespace()));
+
+ dataNodes = rscData.dataNodes();
+ assertThat(1, is(dataNodes.size()));
+
+ node = dataNodes.get(0);
+
+ validateDataNode(node, "vpn-services", NAME_SPACE_SVC,
+ SINGLE_INSTANCE_NODE,
+ true, null);
+ //validate vpn-services 's child nodes.
+ //first validate vpn-services.
+ Map<NodeKey, DataNode> childMap = ((InnerNode) node).childNodes();
+ assertThat(1, is(childMap.size()));
+
+ Iterator<Map.Entry<NodeKey, DataNode>> it = childMap.entrySet().iterator();
+ Map.Entry<NodeKey, DataNode> n = it.next();
+ validateDataNode(n.getValue(), "vpn-svc", NAME_SPACE_SVC,
+ MULTI_INSTANCE_NODE, true, null);
+ }
+
+ /**
+ * Unit test for model id with l3vpn-svc and vpn-services and container
+ * object of list.
+ */
+ @Test
+ public void modelIdForVpnServicesAndChild() {
+ setUp();
+ data = new DefaultModelObjectData.Builder();
+ data.addModelObject((ModelObject) l3VpnObject().vpnServices()
+ .vpnSvc().get(0));
+ data.identifier(ModelObjectId.builder()
+ .addChild(DefaultL3VpnSvc.class)
+ .addChild(DefaultVpnServices.class)
+ .build());
+ rscData = treeBuilder.getResourceData(data.build());
+
+ id = rscData.resourceId();
+ keys = id.nodeKeys();
+ assertThat(3, is(keys.size()));
+
+ sid = keys.get(0).schemaId();
+ assertThat("/", is(sid.name()));
+ assertThat(null, is(sid.namespace()));
+
+ sid = keys.get(1).schemaId();
+ assertThat("l3vpn-svc", is(sid.name()));
+ assertThat(NAME_SPACE_SVC, is(sid.namespace()));
+
+ sid = keys.get(2).schemaId();
+ assertThat("vpn-services", is(sid.name()));
+ assertThat(NAME_SPACE_SVC, is(sid.namespace()));
+
+ dataNodes = rscData.dataNodes();
+ assertThat(1, is(dataNodes.size()));
+
+ node = dataNodes.get(0);
+ validateDataNode(node, "vpn-svc", NAME_SPACE_SVC,
+ MULTI_INSTANCE_NODE, true, null);
+ }
+
+ /**
+ * Unit test for model id for l3vpn svc and container object of sites.
+ */
+ @Test
+ public void modelObjSites() {
+ setUp();
+ data = new DefaultModelObjectData.Builder();
+ data.addModelObject((ModelObject) l3VpnObject().sites());
+ data.identifier(ModelObjectId.builder()
+ .addChild(DefaultL3VpnSvc.class)
+ .build());
+ rscData = treeBuilder.getResourceData(data.build());
+
+ id = rscData.resourceId();
+ keys = id.nodeKeys();
+ assertThat(2, is(keys.size()));
+
+ sid = keys.get(0).schemaId();
+ assertThat("/", is(sid.name()));
+ assertThat(null, is(sid.namespace()));
+
+ sid = keys.get(1).schemaId();
+ assertThat("l3vpn-svc", is(sid.name()));
+ assertThat(NAME_SPACE_SVC, is(sid.namespace()));
+
+ dataNodes = rscData.dataNodes();
+ assertThat(1, is(dataNodes.size()));
+
+ //validate l3vpn-svc 's child nodes.
+ //first validate vpn-services.
+
+ node = dataNodes.get(0);
+
+ validateDataNode(node, "sites", NAME_SPACE_SVC,
+ SINGLE_INSTANCE_NODE,
+ true, null);
+ //validate l3vpn-svc 's child nodes.
+ //now validate site network access.
+ Map<NodeKey, DataNode> childMap = ((InnerNode) node).childNodes();
+ assertThat(1, is(childMap.size()));
+ childMap = ((InnerNode) node).childNodes();
+
+ Iterator<Map.Entry<NodeKey, DataNode>> it = childMap.entrySet().iterator();
+ Map.Entry<NodeKey, DataNode> n = it.next();
+
+ //list site
+ validateDataNode(n.getValue(), "site", NAME_SPACE_SVC,
+ MULTI_INSTANCE_NODE, true, null);
+
+ childMap = ((InnerNode) n.getValue()).childNodes();
+ assertThat(2, is(childMap.size()));
+ it = childMap.entrySet().iterator();
+ n = it.next();
+
+ //leaf site-id
+ validateDataNode(n.getValue(), "site-id", NAME_SPACE_SVC,
+ SINGLE_INSTANCE_LEAF_VALUE_NODE, true, "first-site");
+
+ //container site network access
+ n = it.next();
+ validateDataNode(n.getValue(), "site-network-accesses", NAME_SPACE_SVC,
+ SINGLE_INSTANCE_NODE, true, null);
+
+ childMap = ((InnerNode) n.getValue()).childNodes();
+ assertThat(1, is(childMap.size()));
+ it = childMap.entrySet().iterator();
+ n = it.next();
+
+ //list site network access.
+ validateDataNode(n.getValue(), "site-network-access", NAME_SPACE_SVC,
+ MULTI_INSTANCE_NODE, true, null);
+
+ childMap = ((InnerNode) n.getValue()).childNodes();
+ assertThat(6, is(childMap.size()));
+ it = childMap.entrySet().iterator();
+ n = it.next();
+
+ //leaf site network access id.
+ validateDataNode(n.getValue(), "site-network-access-id", NAME_SPACE_SVC,
+ SINGLE_INSTANCE_LEAF_VALUE_NODE, true,
+ "first-site-network-access-id");
+
+ n = it.next();
+ //leaf site network access type.
+ validateDataNode(n.getValue(), "site-network-access-type", NAME_SPACE_SVC,
+ SINGLE_INSTANCE_LEAF_VALUE_NODE, true,
+ "site-network-access-type");
+
+ n = it.next();
+ //grouping container bearer with augments.
+ validateDataNode(n.getValue(), "bearer", NAME_SPACE_SVC,
+ SINGLE_INSTANCE_NODE, true,
+ null);
+
+ //validate child nodes of bearer.
+ validateBearer(n.getValue());
+
+ n = it.next();
+ //container ip connection form grouping.
+ validateDataNode(n.getValue(), "ip-connection", NAME_SPACE_SVC,
+ SINGLE_INSTANCE_NODE, true,
+ null);
+
+ //validate ip connections's child node.
+ validateIpConnections(n.getValue());
+
+ n = it.next();
+ //container routing protocols form grouping.
+ validateDataNode(n.getValue(), "routing-protocols", NAME_SPACE_SVC,
+ SINGLE_INSTANCE_NODE, true,
+ null);
+
+ //validate child nodes of routing protocols
+ validateRoutingProtocols(n.getValue());
+
+ n = it.next();
+ //container vpn attachment form grouping.
+ validateDataNode(n.getValue(), "vpn-attachment", NAME_SPACE_SVC,
+ SINGLE_INSTANCE_NODE, true,
+ null);
+
+ //validate child node of vpn attachments.
+ validateVpnAttachments(n.getValue());
+ }
+
+ /**
+ * Unit test for model id sites container and object of list site.
+ */
+ @Test
+ public void modelObjSite() {
+ setUp();
+ data = new DefaultModelObjectData.Builder();
+ data.addModelObject((ModelObject) l3VpnObject().sites().site().get(0));
+ data.identifier(ModelObjectId.builder()
+ .addChild(DefaultL3VpnSvc.class)
+ .addChild(DefaultSites.class)
+ .build());
+ rscData = treeBuilder.getResourceData(data.build());
+
+ id = rscData.resourceId();
+ keys = id.nodeKeys();
+ assertThat(3, is(keys.size()));
+
+ sid = keys.get(0).schemaId();
+ assertThat("/", is(sid.name()));
+ assertThat(null, is(sid.namespace()));
+
+ sid = keys.get(1).schemaId();
+ assertThat("l3vpn-svc", is(sid.name()));
+ assertThat(NAME_SPACE_SVC, is(sid.namespace()));
+
+ sid = keys.get(2).schemaId();
+ assertThat("sites", is(sid.name()));
+ assertThat(NAME_SPACE_SVC, is(sid.namespace()));
+
+ dataNodes = rscData.dataNodes();
+ assertThat(1, is(dataNodes.size()));
+
+ //validate l3vpn-svc 's child nodes.
+ //first validate vpn-services.
+
+ node = dataNodes.get(0);
+ //list site
+ validateDataNode(node, "site", NAME_SPACE_SVC,
+ MULTI_INSTANCE_NODE, true, null);
+
+ Map<NodeKey, DataNode> childMap = ((InnerNode) node).childNodes();
+ assertThat(2, is(childMap.size()));
+ childMap = ((InnerNode) node).childNodes();
+
+ Iterator<Map.Entry<NodeKey, DataNode>> it = childMap.entrySet().iterator();
+ Map.Entry<NodeKey, DataNode> n = it.next();
+
+ //leaf site-id
+ validateDataNode(n.getValue(), "site-id", NAME_SPACE_SVC,
+ SINGLE_INSTANCE_LEAF_VALUE_NODE, true, "first-site");
+
+ //container site network access
+ n = it.next();
+ validateDataNode(n.getValue(), "site-network-accesses", NAME_SPACE_SVC,
+ SINGLE_INSTANCE_NODE, true, null);
+
+ childMap = ((InnerNode) n.getValue()).childNodes();
+ assertThat(1, is(childMap.size()));
+ it = childMap.entrySet().iterator();
+ n = it.next();
+
+ //list site network access.
+ validateDataNode(n.getValue(), "site-network-access", NAME_SPACE_SVC,
+ MULTI_INSTANCE_NODE, true, null);
+
+ childMap = ((InnerNode) n.getValue()).childNodes();
+ assertThat(6, is(childMap.size()));
+ it = childMap.entrySet().iterator();
+ n = it.next();
+
+ //leaf site network access id.
+ validateDataNode(n.getValue(), "site-network-access-id", NAME_SPACE_SVC,
+ SINGLE_INSTANCE_LEAF_VALUE_NODE, true,
+ "first-site-network-access-id");
+
+ n = it.next();
+ //leaf site network access type.
+ validateDataNode(n.getValue(), "site-network-access-type", NAME_SPACE_SVC,
+ SINGLE_INSTANCE_LEAF_VALUE_NODE, true,
+ "site-network-access-type");
+
+ n = it.next();
+ //grouping container bearer with augments.
+ validateDataNode(n.getValue(), "bearer", NAME_SPACE_SVC,
+ SINGLE_INSTANCE_NODE, true,
+ null);
+
+ //validate child nodes of bearer.
+ validateBearer(n.getValue());
+
+ n = it.next();
+ //container ip connection form grouping.
+ validateDataNode(n.getValue(), "ip-connection", NAME_SPACE_SVC,
+ SINGLE_INSTANCE_NODE, true,
+ null);
+
+ //validate ip connections's child node.
+ validateIpConnections(n.getValue());
+
+ n = it.next();
+ //container routing protocols form grouping.
+ validateDataNode(n.getValue(), "routing-protocols", NAME_SPACE_SVC,
+ SINGLE_INSTANCE_NODE, true,
+ null);
+
+ //validate child nodes of routing protocols
+ validateRoutingProtocols(n.getValue());
+
+ n = it.next();
+ //container vpn attachment form grouping.
+ validateDataNode(n.getValue(), "vpn-attachment", NAME_SPACE_SVC,
+ SINGLE_INSTANCE_NODE, true,
+ null);
+
+ //validate child node of vpn attachments.
+ validateVpnAttachments(n.getValue());
+ }
+
+ /**
+ * Unit test for model id site and container object of list site network
+ * access container.
+ */
+ @Test
+ public void modelIdSite() {
+ setUp();
+ data = new DefaultModelObjectData.Builder();
+ data.addModelObject((ModelObject) l3VpnObject().sites().site().get(0)
+ .siteNetworkAccesses());
+ SiteKeys siteKeys = new SiteKeys();
+ siteKeys.siteId(SvcId.fromString("site-keys"));
+ data.identifier(ModelObjectId.builder()
+ .addChild(DefaultL3VpnSvc.class)
+ .addChild(DefaultSites.class)
+ .addChild(DefaultSite.class, siteKeys)
+ .build());
+ rscData = treeBuilder.getResourceData(data.build());
+
+ id = rscData.resourceId();
+ keys = id.nodeKeys();
+ assertThat(4, is(keys.size()));
+
+ sid = keys.get(0).schemaId();
+ assertThat("/", is(sid.name()));
+ assertThat(null, is(sid.namespace()));
+
+ sid = keys.get(1).schemaId();
+ assertThat("l3vpn-svc", is(sid.name()));
+ assertThat(NAME_SPACE_SVC, is(sid.namespace()));
+
+ sid = keys.get(2).schemaId();
+ assertThat("sites", is(sid.name()));
+ assertThat(NAME_SPACE_SVC, is(sid.namespace()));
+
+ sid = keys.get(3).schemaId();
+ assertThat("site", is(sid.name()));
+ assertThat(NAME_SPACE_SVC, is(sid.namespace()));
+
+ NodeKey key = keys.get(3);
+ assertThat(true, is(key instanceof ListKey));
+
+ ListKey listKey = (ListKey) key;
+ List<KeyLeaf> keyLeaves = listKey.keyLeafs();
+ assertThat(1, is(keyLeaves.size()));
+
+ KeyLeaf keyLeaf = keyLeaves.get(0);
+ sid = keyLeaf.leafSchema();
+ assertThat("site-id", is(sid.name()));
+ assertThat(NAME_SPACE_SVC, is(sid.namespace()));
+
+ assertThat(true, is(keyLeaf.leafValue() instanceof SvcId));
+ assertThat("site-keys", is(keyLeaf.leafValAsString()));
+
+ SvcId id = (SvcId) keyLeaf.leafValue();
+ assertThat("site-keys", is(id.string()));
+
+ dataNodes = rscData.dataNodes();
+ assertThat(1, is(dataNodes.size()));
+
+ //validate l3vpn-svc 's child nodes.
+ //first validate vpn-services.
+
+ node = dataNodes.get(0);
+
+ //container site network access
+ validateDataNode(node, "site-network-accesses", NAME_SPACE_SVC,
+ SINGLE_INSTANCE_NODE, true, null);
+
+ Map<NodeKey, DataNode> childMap = ((InnerNode) node).childNodes();
+ assertThat(1, is(childMap.size()));
+ childMap = ((InnerNode) node).childNodes();
+
+ Iterator<Map.Entry<NodeKey, DataNode>> it = childMap.entrySet().iterator();
+ Map.Entry<NodeKey, DataNode> n = it.next();
+
+ //list site network access.
+ validateDataNode(n.getValue(), "site-network-access", NAME_SPACE_SVC,
+ MULTI_INSTANCE_NODE, true, null);
+
+ childMap = ((InnerNode) n.getValue()).childNodes();
+ assertThat(6, is(childMap.size()));
+ it = childMap.entrySet().iterator();
+ n = it.next();
+
+ //leaf site network access id.
+ validateDataNode(n.getValue(), "site-network-access-id", NAME_SPACE_SVC,
+ SINGLE_INSTANCE_LEAF_VALUE_NODE, true,
+ "first-site-network-access-id");
+
+ n = it.next();
+ //leaf site network access type.
+ validateDataNode(n.getValue(), "site-network-access-type", NAME_SPACE_SVC,
+ SINGLE_INSTANCE_LEAF_VALUE_NODE, true,
+ "site-network-access-type");
+
+ n = it.next();
+ //grouping container bearer with augments.
+ validateDataNode(n.getValue(), "bearer", NAME_SPACE_SVC,
+ SINGLE_INSTANCE_NODE, true,
+ null);
+
+ //validate child nodes of bearer.
+ validateBearer(n.getValue());
+
+ n = it.next();
+ //container ip connection form grouping.
+ validateDataNode(n.getValue(), "ip-connection", NAME_SPACE_SVC,
+ SINGLE_INSTANCE_NODE, true,
+ null);
+
+ //validate ip connections's child node.
+ validateIpConnections(n.getValue());
+
+ n = it.next();
+ //container routing protocols form grouping.
+ validateDataNode(n.getValue(), "routing-protocols", NAME_SPACE_SVC,
+ SINGLE_INSTANCE_NODE, true,
+ null);
+
+ //validate child nodes of routing protocols
+ validateRoutingProtocols(n.getValue());
+
+ n = it.next();
+ //container vpn attachment form grouping.
+ validateDataNode(n.getValue(), "vpn-attachment", NAME_SPACE_SVC,
+ SINGLE_INSTANCE_NODE, true,
+ null);
+
+ //validate child node of vpn attachments.
+ validateVpnAttachments(n.getValue());
+ }
+
+ /**
+ * Unit test for model id site network accesses and object of site
+ * network access list.
+ */
+ @Test
+ public void modelIdSiteNetworkAccess() {
+ setUp();
+ data = new DefaultModelObjectData.Builder();
+ data.addModelObject((ModelObject) l3VpnObject().sites().site().get(0)
+ .siteNetworkAccesses().siteNetworkAccess().get(0));
+ SiteKeys siteKeys = new SiteKeys();
+ siteKeys.siteId(SvcId.fromString("site-keys"));
+ data.identifier(ModelObjectId.builder()
+ .addChild(DefaultL3VpnSvc.class)
+ .addChild(DefaultSites.class)
+ .addChild(DefaultSite.class, siteKeys)
+ .addChild(DefaultSiteNetworkAccesses.class)
+ .build());
+ rscData = treeBuilder.getResourceData(data.build());
+
+ id = rscData.resourceId();
+ keys = id.nodeKeys();
+ assertThat(5, is(keys.size()));
+
+ sid = keys.get(0).schemaId();
+ assertThat("/", is(sid.name()));
+ assertThat(null, is(sid.namespace()));
+
+ sid = keys.get(1).schemaId();
+ assertThat("l3vpn-svc", is(sid.name()));
+ assertThat(NAME_SPACE_SVC, is(sid.namespace()));
+
+ sid = keys.get(2).schemaId();
+ assertThat("sites", is(sid.name()));
+ assertThat(NAME_SPACE_SVC, is(sid.namespace()));
+
+ sid = keys.get(3).schemaId();
+ assertThat("site", is(sid.name()));
+ assertThat(NAME_SPACE_SVC, is(sid.namespace()));
+
+ NodeKey key = keys.get(3);
+ assertThat(true, is(key instanceof ListKey));
+
+ ListKey listKey = (ListKey) key;
+ List<KeyLeaf> keyLeaves = listKey.keyLeafs();
+ assertThat(1, is(keyLeaves.size()));
+
+ KeyLeaf keyLeaf = keyLeaves.get(0);
+ sid = keyLeaf.leafSchema();
+ assertThat("site-id", is(sid.name()));
+ assertThat(NAME_SPACE_SVC, is(sid.namespace()));
+
+ assertThat(true, is(keyLeaf.leafValue() instanceof SvcId));
+ assertThat("site-keys", is(keyLeaf.leafValAsString()));
+
+ SvcId id = (SvcId) keyLeaf.leafValue();
+ assertThat("site-keys", is(id.string()));
+
+ sid = keys.get(4).schemaId();
+ assertThat("site-network-accesses", is(sid.name()));
+ assertThat(NAME_SPACE_SVC, is(sid.namespace()));
+
+ dataNodes = rscData.dataNodes();
+ assertThat(1, is(dataNodes.size()));
+
+ //validate l3vpn-svc 's child nodes.
+ //first validate vpn-services.
+
+ node = dataNodes.get(0);
+ //list site network access.
+ validateDataNode(node, "site-network-access", NAME_SPACE_SVC,
+ MULTI_INSTANCE_NODE, true, null);
+
+ Map<NodeKey, DataNode> childMap = ((InnerNode) node).childNodes();
+ assertThat(6, is(childMap.size()));
+ childMap = ((InnerNode) node).childNodes();
+
+ Iterator<Map.Entry<NodeKey, DataNode>> it = childMap.entrySet().iterator();
+ Map.Entry<NodeKey, DataNode> n = it.next();
+
+ //leaf site network access id.
+ validateDataNode(n.getValue(), "site-network-access-id", NAME_SPACE_SVC,
+ SINGLE_INSTANCE_LEAF_VALUE_NODE, true,
+ "first-site-network-access-id");
+
+ n = it.next();
+ //leaf site network access type.
+ validateDataNode(n.getValue(), "site-network-access-type", NAME_SPACE_SVC,
+ SINGLE_INSTANCE_LEAF_VALUE_NODE, true,
+ "site-network-access-type");
+
+ n = it.next();
+ //grouping container bearer with augments.
+ validateDataNode(n.getValue(), "bearer", NAME_SPACE_SVC,
+ SINGLE_INSTANCE_NODE, true,
+ null);
+
+ //validate child nodes of bearer.
+ validateBearer(n.getValue());
+
+ n = it.next();
+ //container ip connection form grouping.
+ validateDataNode(n.getValue(), "ip-connection", NAME_SPACE_SVC,
+ SINGLE_INSTANCE_NODE, true,
+ null);
+
+ //validate ip connections's child node.
+ validateIpConnections(n.getValue());
+
+ n = it.next();
+ //container routing protocols form grouping.
+ validateDataNode(n.getValue(), "routing-protocols", NAME_SPACE_SVC,
+ SINGLE_INSTANCE_NODE, true,
+ null);
+
+ //validate child nodes of routing protocols
+ validateRoutingProtocols(n.getValue());
+
+ n = it.next();
+ //container vpn attachment form grouping.
+ validateDataNode(n.getValue(), "vpn-attachment", NAME_SPACE_SVC,
+ SINGLE_INSTANCE_NODE, true,
+ null);
+
+ //validate child node of vpn attachments.
+ validateVpnAttachments(n.getValue());
+ }
+
+
+ //Validates bearer containers child nodes.
+ private void validateBearer(DataNode node) {
+ Map<NodeKey, DataNode> childMap = ((InnerNode) node).childNodes();
+ assertThat(3, is(childMap.size()));
+
+ Iterator<Map.Entry<NodeKey, DataNode>> it = childMap.entrySet().iterator();
+ Map.Entry<NodeKey, DataNode> n = it.next();
+
+ //container attachment added from augment.
+ validateDataNode(n.getValue(), "bearer-reference", NAME_SPACE_SVC,
+ SINGLE_INSTANCE_LEAF_VALUE_NODE, true,
+ "first-ref");
+
+ n = it.next();
+ validateDataNode(n.getValue(), "bearer-attachment", NAME_SPACE_EXT,
+ SINGLE_INSTANCE_NODE, true,
+ null);
+
+ //handle child nodes of bearer attachments.
+ childMap = ((InnerNode) n.getValue()).childNodes();
+ assertThat(2, is(childMap.size()));
+ Iterator<Map.Entry<NodeKey, DataNode>> it2 = childMap.entrySet()
+ .iterator();
+ Map.Entry<NodeKey, DataNode> n2 = it2.next();
+
+ validateDataNode(n2.getValue(), "pe-name", NAME_SPACE_EXT,
+ SINGLE_INSTANCE_LEAF_VALUE_NODE, true,
+ "first-pe");
+
+ n2 = it2.next();
+ validateDataNode(n2.getValue(), "pe-mgmt-ip", NAME_SPACE_EXT,
+ SINGLE_INSTANCE_LEAF_VALUE_NODE, true,
+ "1.1.1.1");
+
+ n = it.next();
+ validateDataNode(n.getValue(), "requested-type", NAME_SPACE_SVC,
+ SINGLE_INSTANCE_NODE, true,
+ null);
+
+ childMap = ((InnerNode) n.getValue()).childNodes();
+ assertThat(1, is(childMap.size()));
+ it2 = childMap.entrySet().iterator();
+ n2 = it2.next();
+ validateDataNode(n2.getValue(), "requested-type-profile",
+ NAME_SPACE_EXT, SINGLE_INSTANCE_NODE, true,
+ null);
+
+ childMap = ((InnerNode) n2.getValue()).childNodes();
+ assertThat(2, is(childMap.size()));
+ it2 = childMap.entrySet().iterator();
+ n2 = it2.next();
+ validateDataNode(n2.getValue(), "circuit-id",
+ NAME_SPACE_EXT, SINGLE_INSTANCE_LEAF_VALUE_NODE, true,
+ "first-circuit-id");
+
+ n2 = it2.next();
+ validateDataNode(n2.getValue(), "physical",
+ NAME_SPACE_EXT, SINGLE_INSTANCE_NODE, true,
+ null);
+
+ childMap = ((InnerNode) n2.getValue()).childNodes();
+ assertThat(1, is(childMap.size()));
+ it2 = childMap.entrySet().iterator();
+ n2 = it2.next();
+ validateDataNode(n2.getValue(), "physical-if",
+ NAME_SPACE_EXT, SINGLE_INSTANCE_LEAF_VALUE_NODE, true,
+ "first-id");
+ }
+
+ //validates ip connections
+ private void validateIpConnections(DataNode node) {
+ Map<NodeKey, DataNode> childMap = ((InnerNode) node).childNodes();
+ assertThat(1, is(childMap.size()));
+
+ Iterator<Map.Entry<NodeKey, DataNode>> it = childMap.entrySet().iterator();
+ Map.Entry<NodeKey, DataNode> n = it.next();
+
+ //container ipv4.
+ validateDataNode(n.getValue(), "ipv4", NAME_SPACE_SVC,
+ SINGLE_INSTANCE_NODE, true,
+ null);
+
+ //handle child nodes of bearer attachments.
+ childMap = ((InnerNode) n.getValue()).childNodes();
+ assertThat(3, is(childMap.size()));
+ Iterator<Map.Entry<NodeKey, DataNode>> it2 = childMap.entrySet()
+ .iterator();
+ Map.Entry<NodeKey, DataNode> n2 = it2.next();
+
+ validateDataNode(n2.getValue(), "address-allocation-type", NAME_SPACE_SVC,
+ SINGLE_INSTANCE_LEAF_VALUE_NODE, true,
+ "address-allocation-type");
+
+ n2 = it2.next();
+ validateDataNode(n2.getValue(), "number-of-dynamic-address", NAME_SPACE_SVC,
+ SINGLE_INSTANCE_LEAF_VALUE_NODE, true,
+ "2");
+
+ n2 = it2.next();
+ validateDataNode(n2.getValue(), "addresses", NAME_SPACE_SVC,
+ SINGLE_INSTANCE_NODE, true,
+ null);
+
+ childMap = ((InnerNode) n2.getValue()).childNodes();
+ assertThat(1, is(childMap.size()));
+ it2 = childMap.entrySet().iterator();
+ n2 = it2.next();
+ //child node of addresses
+ validateDataNode(n2.getValue(), "customer-address", NAME_SPACE_SVC,
+ SINGLE_INSTANCE_LEAF_VALUE_NODE, true,
+ "2.2.2.2");
+ }
+
+ //validate routing protocols
+ private void validateRoutingProtocols(DataNode node) {
+ Map<NodeKey, DataNode> childMap = ((InnerNode) node).childNodes();
+ assertThat(1, is(childMap.size()));
+
+ Iterator<Map.Entry<NodeKey, DataNode>> it = childMap.entrySet().iterator();
+ Map.Entry<NodeKey, DataNode> n = it.next();
+
+ validateDataNode(n.getValue(), "routing-protocol", NAME_SPACE_SVC,
+ MULTI_INSTANCE_NODE, true,
+ null);
+
+ //handle child nodes of bearer attachments.
+ childMap = ((InnerNode) n.getValue()).childNodes();
+ assertThat(2, is(childMap.size()));
+ Iterator<Map.Entry<NodeKey, DataNode>> it2 = childMap.entrySet()
+ .iterator();
+ Map.Entry<NodeKey, DataNode> n2 = it2.next();
+
+ validateDataNode(n2.getValue(), "type", NAME_SPACE_SVC,
+ SINGLE_INSTANCE_LEAF_VALUE_NODE, true,
+ "routing-protocol-type");
+
+ n2 = it2.next();
+ validateDataNode(n2.getValue(), "bgp", NAME_SPACE_SVC,
+ SINGLE_INSTANCE_NODE, true,
+ null);
+
+ childMap = ((InnerNode) n2.getValue()).childNodes();
+ assertThat(1, is(childMap.size()));
+ it2 = childMap.entrySet().iterator();
+ n2 = it2.next();
+ //child node of bgp
+ validateDataNode(n2.getValue(), "autonomous-system", NAME_SPACE_SVC,
+ SINGLE_INSTANCE_LEAF_VALUE_NODE, true,
+ "120");
+ }
+
+ //validates vpn attachments.
+ private void validateVpnAttachments(DataNode node) {
+ Map<NodeKey, DataNode> childMap = ((InnerNode) node).childNodes();
+ assertThat(1, is(childMap.size()));
+
+ Iterator<Map.Entry<NodeKey, DataNode>> it = childMap.entrySet().iterator();
+ Map.Entry<NodeKey, DataNode> n = it.next();
+
+ validateDataNode(n.getValue(), "site-role", NAME_SPACE_SVC,
+ SINGLE_INSTANCE_LEAF_VALUE_NODE, true,
+ "site-role");
+ }
+
+
+ /**
+ * Returns l3vpn object.
+ *
+ * @return l3vpn object
+ */
+ private DefaultL3VpnSvc l3VpnObject() {
+ DefaultL3VpnSvc main = new DefaultL3VpnSvc();
+
+ //Default l3vpn service
+ DefaultVpnServices services = new DefaultVpnServices();
+
+ //list vpnSvc
+
+ DefaultVpnSvc svc = new DefaultVpnSvc();
+ svc.vpnId(SvcId.fromString("first-id"));
+
+ //svc added.
+ services.addToVpnSvc(svc);
+
+ //add vpn services to l3vpn svc.
+ main.vpnServices(services);
+
+ //Sites container
+ DefaultSites sites = new DefaultSites();
+
+ //site list
+ DefaultSite site = new DefaultSite();
+ site.siteId(SvcId.fromString("first-site"));
+
+ //default network access container.
+ DefaultSiteNetworkAccesses access = new
+ DefaultSiteNetworkAccesses();
+
+ DefaultSiteNetworkAccess listAccess = new DefaultSiteNetworkAccess();
+ listAccess.siteNetworkAccessId(SvcId.fromString(
+ "first-site-network-access-id"));
+
+ //handle augments and uses
+
+ DefaultBearer bearer = new DefaultBearer();
+
+ //augment augmenting bearer.
+ DefaultAugmentedL3VpnBearer augmentedL3VpnBearer = new
+ DefaultAugmentedL3VpnBearer();
+
+ //augments child bearer attachment
+ DefaultBearerAttachment attachment = new DefaultBearerAttachment();
+ attachment.peMgmtIp(Ipv4Address.fromString("1.1.1.1"));
+ attachment.peName("first-pe");
+ augmentedL3VpnBearer.bearerAttachment(attachment);
+
+ //adding bearer augment
+ bearer.addAugmentation(augmentedL3VpnBearer);
+ bearer.bearerReference("first-ref");
+
+ DefaultRequestedType requestedType = new DefaultRequestedType();
+ //add augment for request type.
+
+ DefaultAugmentedL3VpnRequestedType augmentedL3VpnRequestedType =
+ new DefaultAugmentedL3VpnRequestedType();
+ DefaultRequestedTypeProfile profile = new DefaultRequestedTypeProfile();
+ profile.circuitId("first-circuit-id");
+
+ //Added default case in augments child container.
+ DefaultPhysicalCase physicalCase = new DefaultPhysicalCase();
+ DefaultPhysical physical = new DefaultPhysical();
+ physical.physicalIf("first-id");
+
+ //add container in case.
+ physicalCase.physical(physical);
+
+ //added choice in container profile
+ profile.requestedTypeChoice(physicalCase);
+ //added in augment.
+ augmentedL3VpnRequestedType.requestedTypeProfile(profile);
+
+ requestedType.addAugmentation(augmentedL3VpnRequestedType);
+
+ //added in bearer with augmented request type
+ bearer.requestedType(requestedType);
+
+ //added bearer in access list.
+ listAccess.bearer(bearer);
+
+ //set site network access type.
+ listAccess.siteNetworkAccessType(SiteNetworkAccessType.fromString(
+ "site-network-access-type"));
+
+ DefaultIpConnection ipConnection = new DefaultIpConnection();
+
+ //added ipv4 in ip connection
+ DefaultIpv4 ipv4 = new DefaultIpv4();
+ ipv4.numberOfDynamicAddress((short) 2);
+ ipv4.addressAllocationType(AddressAllocationType.fromString(
+ "address-allocation-type"));
+ DefaultAddresses address = new DefaultAddresses();
+ address.customerAddress(Ipv4Address.fromString("2.2.2.2"));
+ ipv4.addresses(address);
+ ipConnection.ipv4(ipv4);
+
+ //default routing protocols
+ DefaultRoutingProtocols protocols = new DefaultRoutingProtocols();
+ DefaultRoutingProtocol protocol = new DefaultRoutingProtocol();
+ protocol.type(RoutingProtocolType.fromString(
+ "routing-protocol-type"));
+ DefaultBgp bgp = new DefaultBgp();
+ bgp.autonomousSystem(120);
+ protocol.bgp(bgp);
+ protocols.addToRoutingProtocol(protocol);
+
+ //add uses in access list.
+ listAccess.ipConnection(ipConnection);
+ listAccess.routingProtocols(protocols);
+
+ DefaultVpnAttachment defaultVpnAttachment = new DefaultVpnAttachment();
+
+ DefaultVpnId vpnId = new DefaultVpnId();
+ vpnId.siteRole(SiteRole.fromString("site-role"));
+ defaultVpnAttachment.attachmentFlavor(vpnId);
+
+ listAccess.vpnAttachment(defaultVpnAttachment);
+
+ //add list to container.
+ access.addToSiteNetworkAccess(listAccess);
+
+ //add access to site.
+ site.siteNetworkAccesses(access);
+
+ //add site to sites container.
+ sites.addToSite(site);
+
+ //add sites to l3vpnSvc
+ main.sites(sites);
+ return main;
+ }
+}
diff --git a/runtime/src/test/resources/l3vpn/ietf-l3vpn-svc@2016-07-30.yang b/runtime/src/test/resources/l3vpn/ietf-l3vpn-svc@2016-07-30.yang
new file mode 100755
index 0000000..513a61e
--- /dev/null
+++ b/runtime/src/test/resources/l3vpn/ietf-l3vpn-svc@2016-07-30.yang
@@ -0,0 +1,2552 @@
+module ietf-l3vpn-svc {
+
+ namespace "urn:ietf:params:xml:ns:yang:ietf-l3vpn-svc";
+
+ prefix l3vpn-svc;
+
+ import yrt-ietf-inet-types {
+ prefix inet;
+ }
+
+ import yrt-ietf-yang-types {
+ prefix yang;
+ }
+
+ organization
+ "IETF L3SM Working Group";
+
+ contact
+ "WG List: <mailto:l3sm@ietf.org>
+
+ Editor:
+
+ ";
+
+ description
+ "The YANG module defines a generic service configuration
+ model for Layer 3 VPN common across all of the vendor
+ implementations.";
+
+ revision 2016-07-30 {
+ description
+ "Eliminated warnings";
+ reference
+ "draft-ietf-l3sm-l3vpn-service-yang-11";
+ }
+
+ revision 2016-07-05 {
+ description
+ "Draft text update";
+ reference
+ "draft-ietf-l3sm-l3vpn-service-yang-11";
+ }
+ revision 2016-06-27 {
+ description
+ "
+ * Removed templates
+ * Add site-network-access-type
+ * Add a leaf number-of-dynamic-address in case
+ of pe-dhcp addressing;
+
+ ";
+ reference "draft-ietf-l3sm-l3vpn-service-yang-10";
+ }
+ revision 2016-06-10 {
+ description
+ "Add site-vpn-flavor NNI";
+ reference "draft-ietf-l3sm-l3vpn-service-yang-09";
+ }
+ revision 2016-06-09 {
+ description
+ "Traffic protection moved to site level.
+ Decouple operational-requirements in two containers.
+ ";
+ reference "draft-ietf-l3sm-l3vpn-service-yang-08";
+ }
+ revision 2016-06-06 {
+ description
+ "Set config false to actual-site-start and stop
+ Add a container before cloud-access list
+ Add a container before authorized-sites list
+ Add a container before denied-sites list
+ Modified access-diversity modeling
+ Replacing type placement diversity by an identity";
+ reference "draft-ietf-l3sm-l3vpn-service-yang-07";
+ }
+ revision 2016-04-19 {
+ description
+ "* remove reference to core routing model :
+ created new address family identities
+ * added features
+ * Modified bearer parameters
+ * Modified union for ipv4/ipv6 addresses to ip-address
+ type
+ * Add BSR parameters for multicast
+ * Add applications matching for QoS classification
+ ";
+ reference "draft-ietf-l3sm-l3vpn-service-yang-06";
+ }
+ revision 2016-04-05 {
+ description
+ "
+ * Added linecard diverse for site diversity
+ * Added a new diversity enum in placement-diversity : none
+ * Added state to site location
+
+ ";
+ reference "";
+ }
+ revision 2016-03-11 {
+ description
+ "
+ * Modify VPN policy and creating a vpn-policy-list
+ * Add VPN policy reference and VPN ID reference
+ under site-network-access
+ ";
+ reference "draft-ietf-l3sm-l3vpn-service-yang-05";
+ }
+ revision 2016-01-04 {
+ description
+ "
+ * Add extranet-vpn container in vpn-svc
+ * Creating top level containers
+ * Refine groupings
+ * Added site-vpn-flavor
+ ";
+ reference "draft-ietf-l3sm-l3vpn-service-yang-03";
+ }
+ revision 2016-01-04 {
+ description
+ "
+ * qos-profile moved to choice
+ * vpn leaf moved to vpn-id in vpn-policy
+ * added ordered-by user to qos classification list
+ * moved traffic protection to access availability
+ * creating a choice in matching filter for VPN policy
+ * added dot1p matching field in flow-definition
+ ";
+ reference "";
+ }
+ revision 2015-12-07 {
+ description
+ "
+ * A site is now a collection of site-accesses.
+ This was introduced to support M to N availability.
+ * Site-availability has been removed, replaced by
+ availability parameters under site-accesses
+ * Added transport-constraints within vpn-svc
+ ";
+ reference "draft-ietf-l3sm-l3vpn-service-yang-02";
+ }
+ revision 2015-11-03 {
+ description "
+ * Add ToS support in match-flow
+ * nexthop in cascaded lan as mandatory
+ * customer-specific-info deleted and moved to routing
+ protocols
+ * customer-lan-connection modified : need prefix and CE address
+ * add choice in managing PE-CE addressing
+ * Simplifying traffic protection
+ ";
+ reference "";
+ }
+ revision 2015-09-10 {
+ description "
+ * Refine groupings for vpn-svc
+ * Removed name in vpn-svc
+ * id in vpn-svc moved to string
+ * Rename id in vpn-svc to vpn-id
+ * Changed key of vpn-svc list to vpn-id
+ * Add DSCP support in flow definition
+ ";
+ reference "";
+ }
+ revision 2015-08-07 {
+ description
+ "
+ Multicast :
+ * Removed ACL from security
+ * Add FW for site and cloud access
+ ";
+ reference "";
+ }
+ revision 2015-08-05 {
+ description
+ "
+ Multicast :
+ * Removed anycast-rp identity as discovery mechanism
+ * Added rp-group mappings for multicast
+ * Added flag for provider managed RP.
+ ";
+ reference "";
+ }
+ revision 2015-08-03 {
+ description
+ " * Creating multiple reusable groupings
+ * Added mpls leaf in vpn-svc for carrier's carrier case
+ * Modify identity single to single-site
+ * Modify site-type to site-role and also child identities.
+ * Creating OAM container under site and moved BFD in.
+ * Creating flow-definition grouping to be reused
+ in ACL, QoS ...
+ * Simplified VPN policy.
+ * Adding multicast static group to RP mappings.
+ * Removed native-vpn and site-role from global site
+ cfg, now managed within the VPN policy.
+ * Creating a separate list for site templates.
+ ";
+ reference "draft-ietf-l3sm-l3vpn-service-yang-01";
+ }
+ revision 2015-07-02 {
+ reference "draft-ietf-l3sm-l3vpn-service-yang-00";
+ }
+ revision 2015-04-24 {
+ description "
+ * Add encryption parameters
+ * Adding holdtime for BFD.
+ * Add postal address in location
+ ";
+ reference "draft-lstd-l3sm-l3vpn-service-yang-00";
+ }
+ revision 2015-02-05 {
+ description "Initial revision.";
+ reference "draft-l3vpn-service-yang-00";
+ }
+
+ /* Features */
+
+ feature cloud-access {
+ description
+ "Allow VPN to connect to a Cloud Service
+ provider.";
+ }
+ feature multicast {
+ description
+ "Enables multicast capabilities in a VPN";
+ }
+ feature ipv4 {
+ description
+ "Enables IPv4 support in a VPN";
+ }
+ feature ipv6 {
+ description
+ "Enables IPv6 support in a VPN";
+ }
+ feature carrierscarrier {
+ description
+ "Enables support of carrier's carrier";
+ }
+ feature traffic-engineering {
+ description
+ "Enables support of transport constraint.";
+ }
+ feature traffic-engineering-multicast {
+ description
+ "Enables support of transport constraint
+ for multicast.";
+ }
+ feature extranet-vpn {
+ description
+ "Enables support of extranet VPNs";
+ }
+ feature site-diversity {
+ description
+ "Enables support of site diversity constraints";
+ }
+ feature encryption {
+ description
+ "Enables support of encryption";
+ }
+ feature qos {
+ description
+ "Enables support of Class of Services";
+ }
+ feature qos-custom {
+ description
+ "Enables support of custom qos profile";
+ }
+ feature rtg-bgp {
+ description
+ "Enables support of BGP routing protocol.";
+ }
+ feature rtg-rip {
+ description
+ "Enables support of RIP routing protocol.";
+ }
+ feature rtg-ospf {
+ description
+ "Enables support of OSPF routing protocol.";
+ }
+ feature rtg-ospf-sham-link {
+ description
+ "Enables support of OSPF sham-links.";
+ }
+ feature rtg-vrrp {
+ description
+ "Enables support of VRRP routing protocol.";
+ }
+ feature fast-reroute {
+ description
+ "Enables support of Fast Reroute.";
+ }
+ feature bfd {
+ description
+ "Enables support of BFD.";
+ }
+ feature always-on {
+ description
+ "Enables support for always-on access
+ constraint.";
+ }
+ feature requested-type {
+ description
+ "Enables support for requested-type access
+ constraint.";
+ }
+ feature bearer-reference {
+ description
+ "Enables support for bearer-reference access
+ constraint.";
+ }
+
+ /* Typedefs */
+
+ typedef svc-id {
+ type string;
+ description
+ "Defining a type of service component
+ identificators.";
+ }
+
+ typedef template-id {
+ type string;
+ description
+ "Defining a type of service template
+ identificators.";
+ }
+
+ /* Identities */
+
+ identity site-network-access-type {
+ description
+ "Base identity for site-network-access type";
+ }
+ identity point-to-point {
+ base site-network-access-type;
+ description
+ "Identity for point-to-point connection";
+ }
+ identity multipoint {
+ base site-network-access-type;
+ description
+ "Identity for multipoint connection
+ Example : ethernet broadcast segment";
+ }
+ identity placement-diversity {
+ description
+ "Base identity for site placement
+ constraints";
+ }
+ identity pe-diverse {
+ base placement-diversity;
+ description
+ "Identity for PE diversity";
+ }
+ identity pop-diverse {
+ base placement-diversity;
+ description
+ "Identity for POP diversity";
+ }
+ identity linecard-diverse {
+ base placement-diversity;
+ description
+ "Identity for linecard diversity";
+ }
+ identity same-pe {
+ base placement-diversity;
+ description
+ "Identity for having sites connected
+ on the same PE";
+ }
+ identity same-bearer {
+ base placement-diversity;
+ description
+ "Identity for having sites connected
+ using the same bearer";
+ }
+ identity customer-application {
+ description
+ "Base identity for customer application";
+ }
+ identity web {
+ base customer-application;
+ description
+ "Identity for web application (e.g. HTTP,HTTPS)";
+ }
+ identity mail {
+ base customer-application;
+ description
+ "Identity for mail applications";
+ }
+ identity file-transfer {
+ base customer-application;
+ description
+ "Identity for file transfer applications (
+ e.g. FTP, SFTP, ...)";
+ }
+ identity database {
+ base customer-application;
+ description
+ "Identity for database applications";
+ }
+ identity social {
+ base customer-application;
+ description
+ "Identity for social network applications";
+ }
+ identity games {
+ base customer-application;
+ description
+ "Identity for gaming applications";
+ }
+ identity p2p {
+ base customer-application;
+ description
+ "Identity for peer to peer applications";
+ }
+ identity network-management {
+ base customer-application;
+ description
+ "Identity for management applications (e.g. telnet
+ syslog, snmp ...)";
+ }
+ identity voice {
+ base customer-application;
+ description
+ "Identity for voice applications";
+ }
+ identity video {
+ base customer-application;
+ description
+ "Identity for video conference applications";
+ }
+ identity address-family {
+ description
+ "Base identity for an address family.";
+ }
+ identity ipv4 {
+ base address-family;
+ description
+ "Identity for IPv4 address family.";
+ }
+ identity ipv6 {
+ base address-family;
+ description
+ "Identity for IPv6 address family.";
+ }
+ identity site-vpn-flavor {
+ description
+ "Base identity for the site VPN service flavor.";
+ }
+ identity site-vpn-flavor-single {
+ base site-vpn-flavor;
+ description
+ "Base identity for the site VPN service flavor.
+ Used when the site belongs to only one VPN.";
+ }
+ identity site-vpn-flavor-multi {
+ base site-vpn-flavor;
+ description
+ "Base identity for the site VPN service flavor.
+ Used when a logical connection of a site
+ belongs to multiple VPNs.";
+ }
+ identity site-vpn-flavor-sub {
+ base site-vpn-flavor;
+ description
+ "Base identity for the site VPN service flavor.
+ Used when a site has multiple logical connections.
+ Each of the connection may belong to different
+ multiple VPNs.";
+ }
+ identity site-vpn-flavor-nni {
+ base site-vpn-flavor;
+ description
+ "Base identity for the site VPN service flavor.
+ Used to describe a NNI option A connection.";
+ }
+ identity transport-constraint {
+ description
+ "Base identity for transport constraint.";
+ }
+ identity tc-latency {
+ base transport-constraint;
+ description
+ "Base identity for transport constraint
+ based on latency.";
+ }
+ identity tc-jitter {
+ base transport-constraint;
+ description
+ "Base identity for transport constraint
+ based on jitter.";
+ }
+ identity tc-bandwidth {
+ base transport-constraint;
+ description
+ "Base identity for transport constraint
+ based on bandwidth.";
+ }
+ identity tc-path-diversity {
+ base transport-constraint;
+ description
+ "Base identity for transport constraint
+ based on path diversity.";
+ }
+ identity tc-site-diversity {
+ base transport-constraint;
+ description
+ "Base identity for transport constraint
+ based on site diversity.";
+ }
+ identity management {
+ description
+ "Base identity for site management scheme.";
+ }
+ identity co-managed {
+ base management;
+ description
+ "Base identity for comanaged site.";
+ }
+ identity customer-managed {
+ base management;
+ description
+ "Base identity for customer managed site.";
+ }
+ identity provider-managed {
+ base management;
+ description
+ "Base identity for provider managed site.";
+ }
+ identity address-allocation-type {
+ description
+ "Base identity for address-allocation-type
+ for PE-CE link.";
+ }
+ identity pe-dhcp {
+ base address-allocation-type;
+ description
+ "PE router provides DHCP service to CE.";
+ }
+ identity static-address {
+ base address-allocation-type;
+ description
+ "PE-CE addressing is static.";
+ }
+ identity slaac {
+ base address-allocation-type;
+ description
+ "Use IPv6 SLAAC.";
+ }
+ identity site-role {
+ description
+ "Base identity for site type.";
+ }
+ identity any-to-any-role {
+ base site-role;
+ description
+ "Site in a any to any IPVPN.";
+ }
+ identity spoke-role {
+ base site-role;
+ description
+ "Spoke Site in a Hub & Spoke IPVPN.";
+ }
+ identity hub-role {
+ base site-role;
+ description
+ "Hub Site in a Hub & Spoke IPVPN.";
+ }
+ identity vpn-topology {
+ description
+ "Base identity for VPN topology.";
+ }
+ identity any-to-any {
+ base vpn-topology;
+ description
+ "Identity for any to any VPN topology.";
+ }
+ identity hub-spoke {
+ base vpn-topology;
+ description
+ "Identity for Hub'n'Spoke VPN topology.";
+ }
+ identity hub-spoke-disjoint {
+ base vpn-topology;
+ description
+ "Identity for Hub'n'Spoke VPN topology
+ where Hubs cannot talk between each other.";
+ }
+ identity multicast-tree-type {
+ description
+ "Base identity for multicast tree type.";
+ }
+ identity ssm-tree-type {
+ base multicast-tree-type;
+ description
+ "Identity for SSM tree type.";
+ }
+ identity asm-tree-type {
+ base multicast-tree-type;
+ description
+ "Identity for ASM tree type.";
+ }
+ identity bidir-tree-type {
+ base multicast-tree-type;
+ description
+ "Identity for BiDir tree type.";
+ }
+ identity multicast-rp-discovery-type {
+ description
+ "Base identity for rp discovery type.";
+ }
+ identity auto-rp {
+ base multicast-rp-discovery-type;
+ description
+ "Base identity for auto-rp discovery type.";
+ }
+ identity static-rp {
+ base multicast-rp-discovery-type;
+ description
+ "Base identity for static type.";
+ }
+ identity bsr-rp {
+ base multicast-rp-discovery-type;
+ description
+ "Base identity for BDR discovery type.";
+ }
+ identity routing-protocol-type {
+ description
+ "Base identity for routing-protocol type.";
+ }
+ identity ospf {
+ base routing-protocol-type;
+ description
+ "Identity for OSPF protocol type.";
+ }
+ identity bgp {
+ base routing-protocol-type;
+ description
+ "Identity for BGP protocol type.";
+ }
+ identity static {
+ base routing-protocol-type;
+ description
+ "Identity for static routing protocol type.";
+ }
+ identity rip {
+ base routing-protocol-type;
+ description
+ "Identity for RIP protocol type.";
+ }
+ identity rip-ng {
+ base routing-protocol-type;
+ description
+ "Identity for RIPng protocol type.";
+ }
+ identity vrrp {
+ base routing-protocol-type;
+ description
+ "Identity for VRRP protocol type.
+ This is to be used when LAn are directly connected
+ to provider Edge routers.";
+ }
+ identity direct {
+ base routing-protocol-type;
+ description
+ "Identity for direct protocol type.
+ .";
+ }
+ identity protocol-type {
+ description
+ "Base identity for protocol field type.";
+ }
+ identity tcp {
+ base protocol-type;
+ description
+ "TCP protocol type.";
+ }
+ identity udp {
+ base protocol-type;
+ description
+ "UDP protocol type.";
+ }
+ identity icmp {
+ base protocol-type;
+ description
+ "icmp protocol type.";
+ }
+ identity icmp6 {
+ base protocol-type;
+ description
+ "icmp v6 protocol type.";
+ }
+ identity gre {
+ base protocol-type;
+ description
+ "GRE protocol type.";
+ }
+ identity ipip {
+ base protocol-type;
+ description
+ "IPinIP protocol type.";
+ }
+ identity hop-by-hop {
+ base protocol-type;
+ description
+ "Hop by Hop IPv6 header type.";
+ }
+ identity routing {
+ base protocol-type;
+ description
+ "Routing IPv6 header type.";
+ }
+ identity esp {
+ base protocol-type;
+ description
+ "ESP header type.";
+ }
+ identity ah {
+ base protocol-type;
+ description
+ "AH header type.";
+ }
+
+ /* Groupings */
+
+ grouping vpn-service-cloud-access {
+ container cloud-accesses {
+ list cloud-access {
+ if-feature cloud-access;
+ key cloud-identifier;
+
+ leaf cloud-identifier {
+ type string;
+ description
+ "Identification of cloud service. Local
+ admin meaning.";
+ }
+ container authorized-sites {
+ list authorized-site {
+ key site-id;
+
+ leaf site-id {
+ type leafref {
+ path "/l3vpn-svc/sites/site/site-id";
+ }
+ description
+ "Site ID.";
+ }
+ description
+ "List of authorized sites.";
+ }
+ description
+ "Configuration of authorized sites";
+ }
+ container denied-sites {
+ list denied-site {
+ key site-id;
+
+ leaf site-id {
+ type leafref {
+ path "/l3vpn-svc/sites/site/site-id";
+ }
+ description
+ "Site ID.";
+ }
+ description
+ "List of denied sites.";
+ }
+ description
+ "Configuration of denied sites";
+ }
+ leaf nat-enabled {
+ type boolean;
+ description
+ "Control if NAT is required or not.";
+ }
+ leaf customer-nat-address {
+ type inet:ipv4-address;
+ description
+ "NAT address to be used in case of public
+ or shared cloud.
+ This is to be used in case customer is providing
+ the public address.";
+ }
+ description
+ "Cloud access configuration.";
+ }
+ description
+ "Container for cloud access configurations";
+ }
+ description
+ "grouping for vpn cloud definition";
+ }
+
+ grouping multicast-rp-group-cfg {
+ choice group-format {
+ case startend {
+ leaf group-start {
+ type inet:ip-address;
+ description
+ "First group address.";
+ }
+ leaf group-end {
+ type inet:ip-address;
+ description
+ "Last group address.";
+ }
+ }
+ case singleaddress {
+ leaf group-address {
+ type inet:ip-address;
+ description
+ "Group address";
+ }
+ }
+ description
+ "Choice for group format.";
+ }
+ description
+ "Definition of groups for
+ RP to group mapping.";
+ }
+
+ grouping vpn-service-multicast {
+ container multicast {
+ if-feature multicast;
+ leaf enabled {
+ type boolean;
+ default false;
+ description
+ "Enable multicast.";
+ }
+ container customer-tree-flavors {
+ list tree-flavor {
+ key type;
+
+ leaf type {
+ type identityref {
+ base multicast-tree-type;
+ }
+ description
+ "Type of tree to be used.";
+ }
+ description
+ "List of tree flavors.";
+ }
+ description
+ "Type of trees used by customer.";
+ }
+ container rp {
+ container rp-group-mappings {
+ list rp-group-mapping {
+ key "id";
+
+ leaf id {
+ type uint16;
+ description
+ "Unique identifier for the mapping.";
+ }
+ container provider-managed {
+ leaf enabled {
+ type boolean;
+ default false;
+ description
+ "Set to true, if the RP must be a
+ provider
+ managed node.
+ Set to false, if it is a customer
+ managed node.";
+ }
+
+ leaf rp-redundancy {
+ when "../enabled = 'true'" {
+ description
+ "Relevant when RP
+ is provider managed.";
+ }
+ type boolean;
+ default false;
+ description
+ "If true, redundancy
+ mechanism for RP is required.";
+ }
+ leaf optimal-traffic-delivery {
+ when "../enabled = 'true'" {
+ description
+ "Relevant when RP
+ is provider managed.";
+ }
+ type boolean;
+ default false;
+ description
+ "If true, SP must ensure
+ that traffic uses an optimal path.";
+ }
+ description
+ "Parameters for provider managed RP.";
+ }
+
+ leaf rp-address {
+ when "../provider-managed/enabled='false'" {
+ description
+ "Relevant when RP
+ is provider managed.";
+ }
+ type inet:ip-address;
+ description
+ "Defines the address of the
+ RendezvousPoint.
+ Used if RP is customer managed.";
+ }
+
+ container groups {
+ list group {
+ key id;
+
+ leaf id {
+ type uint16;
+ description
+ "Identifier for the group.";
+ }
+ uses multicast-rp-group-cfg;
+ description
+ "List of groups.";
+ }
+ description
+ "Multicast groups associated with RP.";
+ }
+
+ description
+ "List of RP to group mappings.";
+ }
+ description
+ "RP to group mappings.";
+ }
+ container rp-discovery {
+ leaf rp-discovery-type {
+ type identityref {
+ base multicast-rp-discovery-type;
+ }
+ default static-rp;
+ description
+ "Type of RP discovery used.";
+ }
+ container bsr-candidates {
+ when "../rp-discovery-type='bsr-rp'" {
+ description
+ "Only applicable if discovery type
+ is BSR-RP";
+ }
+ list bsr-candidate {
+ key address;
+
+ leaf address {
+ type inet:ip-address;
+ description
+ "Address of BSR candidate";
+ }
+
+ description
+ "List of customer BSR candidates";
+ }
+ description
+ "Customer BSR candidates address";
+ }
+ description
+ "RP discovery parameters";
+ }
+
+ description
+ "RendezvousPoint parameters.";
+ }
+ description
+ "Multicast global parameters for the VPN service.";
+ }
+ description
+ "grouping for multicast vpn definition";
+ }
+
+ grouping vpn-service-mpls {
+ leaf carrierscarrier {
+ if-feature carrierscarrier;
+ type boolean;
+ default false;
+ description
+ "The VPN is using Carrier's Carrier,
+ and so MPLS is required.";
+ }
+ description
+ "grouping for mpls CsC definition";
+ }
+
+ grouping customer-location-info {
+ container location {
+ leaf address {
+ type string;
+ description
+ "Address (number and street)
+ of the site.";
+
+ }
+ leaf zip-code {
+ type string;
+ description
+ "ZIP code of the site.";
+ }
+ leaf state {
+ type string;
+ description
+ "State of the site.
+ This leaf can also be used
+ to describe a region
+ for country who does not have
+ states.
+ ";
+ }
+ leaf city {
+ type string;
+ description
+ "City of the site.";
+ }
+ leaf country-code {
+ type string;
+ description
+ "Country of the site.";
+ }
+ description
+ "Location of the site.";
+ }
+ description
+ "This grouping defines customer location
+ parameters";
+ }
+
+ grouping site-diversity {
+ container site-diversity {
+
+ container groups {
+ list group {
+ key group-id;
+
+ leaf group-id {
+ type string;
+ }
+ }
+ }
+ }
+ }
+
+ grouping access-diversity {
+ container access-diversity {
+ if-feature site-diversity;
+ container groups {
+ list group {
+ key group-id;
+
+ leaf group-id {
+ type string;
+ description
+ "Group-id the site network access
+ is belonging to";
+ }
+ description
+ "List of group-id";
+ }
+ description
+ "Groups the site network access
+ is belonging to";
+ }
+ container constraints {
+ list constraint {
+ key constraint-type;
+
+ leaf constraint-type {
+ type identityref {
+ base placement-diversity;
+ }
+ description
+ "Diversity constraint type.";
+ }
+ container target {
+ choice target-flavor {
+ case id {
+ list group {
+ key group-id;
+
+ leaf group-id {
+ type string;
+ description
+ "The constraint will apply
+ against this particular
+ group-id";
+ }
+ description
+ "List of groups";
+ }
+ }
+ case all-accesses {
+ leaf all-other-accesses {
+ type empty;
+ description
+ "The constraint will apply
+ against all other site network
+ access
+ of this site";
+ }
+ }
+ case all-groups {
+ leaf all-other-groups {
+ type empty;
+ description
+ "The constraint will apply
+ against all other groups the
+ customer
+ is managing";
+ }
+ }
+ description
+ "Choice for the group definition";
+ }
+ description
+ "The constraint will apply against
+ this list of groups";
+ }
+ description
+ "List of constraints";
+ }
+ description
+ "Constraints for placing this site
+ network access";
+ }
+
+ description
+ "Diversity parameters.";
+ }
+ description
+ "This grouping defines access diversity
+ parameters";
+ }
+
+ grouping operational-requirements {
+ leaf requested-site-start {
+ type yang:date-and-time;
+ description
+ "Optional leaf indicating requested date
+ and time
+ when the service at a particular site is
+ expected
+ to start";
+ }
+
+ leaf requested-site-stop {
+ type yang:date-and-time;
+ description
+ "Optional leaf indicating requested date
+ and time
+ when the service at a particular site is
+ expected
+ to stop";
+ }
+ description
+ "This grouping defines some operational parameters
+ parameters";
+ }
+
+ grouping operational-requirements-ops {
+ leaf actual-site-start {
+ type yang:date-and-time;
+ config false;
+ description
+ "Optional leaf indicating actual date
+ and time
+ when the service at a particular site
+ actually
+ started";
+ }
+ leaf actual-site-stop {
+ type yang:date-and-time;
+ config false;
+ description
+ "Optional leaf indicating actual date
+ and time
+ when the service at a particular site
+ actually
+ stopped";
+ }
+ description
+ "This grouping defines some operational parameters
+ parameters";
+ }
+
+ grouping flow-definition {
+ container match-flow {
+ leaf dscp {
+ type uint8 {
+ range "0 .. 63";
+ }
+ description
+ "DSCP value.";
+ }
+ leaf tos {
+ type uint8 {
+ range "0 .. 254";
+ }
+ description
+ "TOS value.";
+ }
+ leaf dot1p {
+ type uint8 {
+ range "0 .. 7";
+ }
+ description
+ "802.1p matching.";
+ }
+ leaf ipv4-src-prefix {
+ type inet:ipv4-prefix;
+ description
+ "Match on IPv4 src address.";
+ }
+ leaf ipv6-src-prefix {
+ type inet:ipv6-prefix;
+ description
+ "Match on IPv6 src address.";
+ }
+ leaf ipv4-dst-prefix {
+ type inet:ipv4-prefix;
+ description
+ "Match on IPv4 dst address.";
+ }
+ leaf ipv6-dst-prefix {
+ type inet:ipv6-prefix;
+ description
+ "Match on IPv6 dst address.";
+ }
+ leaf l4-src-port {
+ type uint16;
+ description
+ "Match on layer 4 src port.";
+ }
+ leaf l4-dst-port {
+ type uint16;
+ description
+ "Match on layer 4 dst port.";
+ }
+ leaf protocol-field {
+ type union {
+ type uint8;
+ type identityref {
+ base protocol-type;
+ }
+ }
+ description
+ "Match on IPv4 protocol or
+ Ipv6 Next Header
+ field.";
+ }
+
+ description
+ "Describe flow matching
+ criterions.";
+ }
+ description
+ "Flow definition based on criteria.";
+ }
+
+ grouping site-service-basic {
+ leaf svc-input-bandwidth {
+ type uint32;
+ units bps;
+ description
+ "From the PE perspective, the service input
+ bandwidth of the connection.";
+ }
+ leaf svc-output-bandwidth {
+ type uint32;
+ units bps;
+ description
+ "From the PE perspective, the service output
+ bandwidth of the connection.";
+ }
+ leaf svc-mtu {
+ type uint16;
+ units bytes;
+ description
+ "MTU at service level.
+ If the service is IP,
+ it refers to the IP MTU.";
+ }
+ description
+ "Defines basic service parameters for a site.";
+ }
+
+ grouping site-protection {
+ container traffic-protection {
+ if-feature fast-reroute;
+ leaf enabled {
+ type boolean;
+ description
+ "Enables
+ traffic protection of access link.";
+ }
+
+ description
+ "Fast reroute service parameters
+ for the site.";
+ }
+ description
+ "Defines protection service parameters for a site.";
+ }
+
+ grouping site-service-mpls {
+ container carrierscarrier {
+ if-feature carrierscarrier;
+ leaf signalling-type {
+ type enumeration {
+ enum "ldp" {
+ description
+ "Use LDP as signalling
+ protocol between PE and CE.";
+ }
+ enum "bgp" {
+ description
+ "Use BGP 3107 as signalling
+ protocol between PE and CE.
+ In this case, bgp must be also
+ configured
+ as routing-protocol.
+ ";
+ }
+ }
+ description
+ "MPLS signalling type.";
+ }
+ description
+ "This container is used when customer provides
+ MPLS based services.
+ This is used in case of Carrier's
+ Carrier.";
+ }
+ description
+ "Defines MPLS service parameters for a site.";
+ }
+
+ grouping site-service-qos-profile {
+ container qos {
+ if-feature qos;
+ container qos-classification-policy {
+ list rule {
+ key id;
+ ordered-by user;
+
+ leaf id {
+ type uint16;
+ description
+ "ID of the rule.";
+ }
+
+ choice match-type {
+ case match-flow {
+ uses flow-definition;
+ }
+ case match-application {
+ leaf match-application {
+ type identityref {
+ base customer-application;
+ }
+ description
+ "Defines the application
+ to match.";
+ }
+ }
+ description
+ "Choice for classification";
+ }
+
+ leaf target-class-id {
+ type string;
+ description
+ "Identification of the
+ class of service.
+ This identifier is internal to
+ the administration.";
+ }
+
+ description
+ "List of marking rules.";
+ }
+ description
+ "Need to express marking rules ...";
+ }
+ container qos-profile {
+
+ choice qos-profile {
+ description
+ "Choice for QoS profile.
+ Can be standard profile or custom.";
+ case standard {
+ leaf profile {
+ type string;
+ description
+ "QoS profile to be used";
+ }
+ }
+ case custom {
+ container classes {
+ if-feature qos-custom;
+ list class {
+ key class-id;
+
+ leaf class-id {
+ type string;
+ description
+ "Identification of the
+ class of service.
+ This identifier is internal to
+ the administration.";
+ }
+ leaf rate-limit {
+ type uint8;
+ units percent;
+ description
+ "To be used if class must
+ be rate
+ limited. Expressed as
+ percentage of the svc-bw.";
+ }
+ leaf priority-level {
+ type uint8;
+ description
+ "Defines the level of the
+ class in
+ term of priority queueing.
+ The higher the level is the
+ higher
+ is the priority.";
+ }
+ leaf guaranteed-bw-percent {
+ type uint8;
+ units percent;
+ description
+ "To be used to define the
+ guaranteed
+ BW in percent of the svc-bw
+ available at the priority-level.";
+ }
+ description
+ "List of class of services.";
+ }
+ description
+ "Container for
+ list of class of services.";
+ }
+
+ }
+
+ }
+ description
+ "Qos profile configuration.";
+ }
+ description
+ "QoS configuration.";
+ }
+ description
+ "This grouping defines QoS parameters
+ for a site";
+
+ }
+
+ grouping site-security-authentication {
+ container authentication {
+ description
+ "Authentication parameters";
+ }
+ description
+ "This grouping defines authentication
+ parameters
+ for a site";
+ }
+
+ grouping site-security-encryption {
+ container encryption {
+ if-feature encryption;
+ leaf enabled {
+ type boolean;
+ description
+ "If true, access encryption is required.";
+ }
+ leaf layer {
+ type enumeration {
+ enum layer2 {
+ description
+ "Encryption will occur at layer2.";
+ }
+ enum layer3 {
+ description
+ "IPSec is requested.";
+ }
+ }
+ description
+ "Layer on which encryption is applied.";
+ }
+ container encryption-profile {
+ choice profile {
+ case provider-profile {
+ leaf profile-name {
+ type string;
+ description
+ "Name of the SP profile
+ to be applied.";
+ }
+ }
+ case customer-profile {
+ leaf algorithm {
+ type string;
+ description
+ "Encryption algorithm to
+ be used.";
+ }
+ choice key-type {
+ case psk {
+ leaf preshared-key {
+ type string;
+ description
+ "Key coming from
+ customer.";
+ }
+ }
+ case pki {
+
+ }
+ description
+ "Type of keys to be used.";
+ }
+ }
+ description
+ "Choice of profile.";
+ }
+ description
+ "Profile of encryption to be applied.";
+ }
+ description
+ "Encryption parameters.";
+ }
+ description
+ "This grouping defines encryption parameters
+ for a site";
+ }
+
+ grouping site-attachment-bearer {
+ container bearer {
+ container requested-type {
+ if-feature requested-type;
+ leaf requested-type { /* this leaf not used*/
+ type string;
+ description
+ "Type of requested bearer Ethernet, DSL,
+ Wireless ...
+ Operator specific.";
+ }
+ leaf strict { /* this leaf not used*/
+ type boolean;
+ default false;
+ description
+ "define if the requested-type is a preference
+ or a strict requirement.";
+ }
+ description
+ "Container for requested type.";
+ }
+ leaf always-on { /* this leaf not used*/
+ if-feature always-on;
+ type boolean;
+ default true;
+ description
+ "Request for an always on access type.
+ This means no Dial access type for
+ example.";
+ }
+ leaf bearer-reference { /* this leaf not used*/
+ if-feature bearer-reference;
+ type string;
+ description
+ "This is an internal reference for the
+ service provider.
+ Used ";
+ }
+ description
+ "Bearer specific parameters.
+ To be augmented.";
+ }
+ description
+ "Defines physical properties of
+ a site attachment.";
+ }
+
+ grouping site-routing {
+ container routing-protocols {
+ list routing-protocol {
+ key type;
+
+ leaf type {
+ type identityref {
+ base routing-protocol-type;
+ }
+ description
+ "Type of routing protocol.";
+ }
+
+/* From here nothing is used*/
+ container ospf {
+ when "../type = 'ospf'" {
+ description
+ "Only applies
+ when protocol is OSPF.";
+ }
+ if-feature rtg-ospf;
+ leaf-list address-family {
+ type identityref {
+ base address-family;
+ }
+ description
+ "Address family to be activated.";
+ }
+ leaf area-address {
+ type yang:dotted-quad;
+ description
+ "Area address.";
+ }
+ leaf metric {
+ type uint16;
+ description
+ "Metric of PE-CE link.";
+ }
+ container sham-links {
+ if-feature rtg-ospf-sham-link;
+ list sham-link {
+ key target-site;
+
+ leaf target-site {
+ type svc-id;
+ description
+ "Target site for the sham link
+ connection.
+ The site is referred through it's ID.";
+ }
+ leaf metric {
+ type uint16;
+ description
+ "Metric of the sham link.";
+ }
+ description
+ "Creates a shamlink with another
+ site";
+ }
+ description
+ "List of Sham links";
+ }
+ description
+ "OSPF specific configuration.";
+ }
+
+ container bgp {
+
+ when "../type = 'bgp'" {
+ description
+ "Only applies when
+ protocol is BGP.";
+ }
+ if-feature rtg-bgp;
+ leaf autonomous-system {
+ type uint32;
+ description
+ "AS number.";
+ }
+ leaf-list address-family {
+ type identityref {
+ base address-family;
+ }
+ description
+ "Address family to be activated.";
+ }
+ description
+ "BGP specific configuration.";
+ }
+ container static {
+ when "../type = 'static'" {
+ description
+ "Only applies when protocol
+ is static.";
+ }
+
+ container cascaded-lan-prefixes {
+ list ipv4-lan-prefixes {
+ if-feature ipv4;
+ key "lan next-hop";
+
+ leaf lan {
+ type inet:ipv4-prefix;
+ description
+ "Lan prefixes.";
+ }
+ leaf lan-tag {
+ type string;
+ description
+ "Internal tag to be used in vpn
+ policies.";
+ }
+ leaf next-hop {
+ type inet:ipv4-address;
+ description
+ "Nexthop address to use at customer
+ side.";
+ }
+ description "
+ List of LAN prefixes for
+ the site.
+ ";
+ }
+ list ipv6-lan-prefixes {
+ if-feature ipv6;
+ key "lan next-hop";
+
+ leaf lan {
+ type inet:ipv6-prefix;
+ description
+ "Lan prefixes.";
+ }
+ leaf lan-tag {
+ type string;
+ description
+ "Internal tag to be used
+ in vpn policies.";
+ }
+ leaf next-hop {
+ type inet:ipv6-address;
+ description
+ "Nexthop address to use at
+ customer side.";
+ }
+ description "
+ List of LAN prefixes for the site.
+ ";
+ }
+ description
+ "LAN prefixes from the customer.";
+ }
+ description
+ "Static routing
+ specific configuration.";
+ }
+ container rip {
+
+ when "../type = 'rip'" {
+ description
+ "Only applies when
+ protocol is RIP.";
+ }
+ if-feature rtg-rip;
+ leaf-list address-family {
+ type identityref {
+ base address-family;
+ }
+ description
+ "Address family to be
+ activated.";
+ }
+
+ description
+ "RIP routing specific
+ configuration.";
+ }
+
+
+ container vrrp {
+
+ when "../type = 'vrrp'" {
+ description
+ "Only applies when
+ protocol is VRRP.";
+ }
+ if-feature rtg-vrrp;
+ leaf-list address-family {
+ type identityref {
+ base address-family;
+ }
+ description
+ "Address family to be activated.";
+ }
+ description
+ "VRRP routing specific configuration.";
+ }
+
+
+ description
+ "List of routing protocols used
+ on the site.
+ Need to be augmented.";
+ }
+ description
+ "Defines routing protocols.";
+ }
+ description
+ "Grouping for routing protocols.";
+ }
+
+ grouping site-attachment-ip-connection {
+ container ip-connection {
+ container ipv4 {
+ if-feature ipv4;
+ leaf address-allocation-type { /*this is not used*/
+ type identityref {
+ base address-allocation-type;
+ }
+
+ default "static-address";
+ description
+ "Defines how addresses are allocated.
+ ";
+ }
+
+ leaf number-of-dynamic-address { /*this is not used*/
+ when
+ "../address-allocation-type = 'pe-dhcp'"
+ {
+ description
+ "Only applies when
+ protocol allocation type is static";
+ }
+ type uint8;
+ default 1;
+ description
+ "Describes the number of IP addresses the
+ customer requires";
+ }
+ container addresses {
+ when
+ "../address-allocation-type = 'static-address'" {
+ description
+ "Only applies when
+ protocol allocation type is static";
+ }
+ leaf provider-address {
+ type inet:ipv4-address;
+ description
+ "Provider side address.";
+ }
+ leaf customer-address { /*this is not used*/
+ type inet:ipv4-address;
+ description
+ "Customer side address.";
+ }
+ leaf mask {
+ type uint8 {
+ range "0..32";
+ }
+ description
+ "Subnet mask expressed
+ in bits";
+ }
+ description
+ "Describes IP addresses used";
+ }
+ description
+ "IPv4 specific parameters";
+
+ }
+ container ipv6 {
+ if-feature ipv6;
+ leaf address-allocation-type { /*this is not used*/
+ type identityref {
+ base address-allocation-type;
+ }
+ default "static-address";
+ description
+ "Defines how addresses are allocated.
+ ";
+ }
+ leaf number-of-dynamic-address { /*this is not used*/
+ when
+ "../address-allocation-type = 'pe-dhcp'" {
+ description
+ "Only applies when
+ protocol allocation type is static";
+ }
+ type uint8;
+ default 1;
+ description
+ "Describes the number of IP addresses the
+ customer requires";
+ }
+ container addresses {
+ when
+ "../address-allocation-type = 'static-address'" {
+ description
+ "Only applies when
+ protocol allocation type is static";
+ }
+ leaf provider-address {
+ type inet:ipv6-address;
+ description
+ "Provider side address.";
+ }
+ leaf customer-address { /*this is not used*/
+ type inet:ipv6-address;
+ description
+ "Customer side address.";
+ }
+ leaf mask {
+ type uint8 {
+ range "0..128";
+
+ }
+ description
+ "Subnet mask expressed
+ in bits";
+ }
+ description
+ "Describes IP addresses used";
+ }
+
+ description
+ "IPv6 specific parameters";
+
+ }
+ container oam { /*this is not used*/
+ container bfd {
+ if-feature bfd;
+ leaf bfd-enabled {
+ type boolean;
+ description
+ "BFD activation";
+ }
+
+ choice holdtime {
+ case profile {
+ leaf profile-name {
+ type string;
+ description
+ "Service provider well
+ known profile.";
+ }
+ description
+ "Service provider well
+ known profile.";
+ }
+ case fixed {
+ leaf fixed-value {
+ type uint32;
+ units msec;
+ description
+ "Expected holdtime
+ expressed
+ in msec.";
+ }
+ }
+ description
+ "Choice for holdtime flavor.";
+ }
+ description
+ "Container for BFD.";
+ }
+ description
+ "Define the OAM used on the connection.";
+ }
+ description
+ "Defines connection parameters.";
+ }
+ description
+ "This grouping defines IP connection parameters.";
+ }
+
+ grouping site-service-multicast {
+ container multicast {
+ if-feature multicast;
+ leaf multicast-site-type {
+ type enumeration {
+ enum receiver-only {
+ description
+ "The site has only receivers.";
+ }
+ enum source-only {
+ description
+ "The site has only sources.";
+ }
+ enum source-receiver {
+ description
+ "The site has both
+ sources & receivers.";
+ }
+ }
+ default "source-receiver";
+ description
+ "Type of multicast site.";
+ }
+ container multicast-transport-protocol {
+ leaf ipv4 {
+ if-feature ipv4;
+ type boolean;
+ default true;
+ description
+ "Enables ipv4 multicast transport";
+ }
+ leaf ipv6 {
+ if-feature ipv6;
+ type boolean;
+ default false;
+ description
+ "Enables ipv6 multicast transport";
+ }
+ description
+ "Defines protocol to transport multicast.";
+ }
+ leaf protocol-type {
+ type enumeration {
+ enum host {
+ description
+ "
+ Hosts are directly connected
+ to the provider network.
+ Host protocols like IGMP, MLD
+ are required.
+ ";
+ }
+ enum router {
+ description
+ "
+ Hosts are behind a customer router.
+ PIM will be implemented.
+ ";
+ }
+ enum both {
+ description
+ "Some Hosts are behind a customer
+ router and some others are directly
+ connected to the provider network.
+ Both host and routing protocols must be
+ used. Typically IGMP and PIM will be
+ implemented.
+ ";
+ }
+ }
+ default "both";
+ description
+ "Multicast protocol type to be used
+ with the customer site.";
+ }
+
+ description
+ "Multicast parameters for the site.";
+ }
+ description
+ "Multicast parameters for the site.";
+ }
+
+ grouping site-management {
+ container management {
+ leaf type {
+ type identityref {
+ base management;
+ }
+ }
+ leaf management-transport {
+ type identityref {
+ base address-family;
+ }
+ }
+ leaf address {
+ type inet:ip-address;
+ }
+ }
+ }
+
+ grouping site-vpn-flavor-profile {
+ leaf site-vpn-flavor {
+ type identityref {
+ base site-vpn-flavor;
+ }
+ default site-vpn-flavor-single;
+ description
+ "Defines if the site
+ is a single VPN site, or multiVPN or ...";
+ }
+ description
+ "Grouping for site-vpn-flavor.";
+ }
+
+ grouping site-vpn-policy {
+ container vpn-policy-list {
+ list vpn-policy {
+ key vpn-policy-id;
+
+ leaf vpn-policy-id {
+ type svc-id;
+ description
+ "Unique identifier for
+ the VPN policy.";
+ }
+
+ list entries {
+ key id;
+
+ leaf id {
+ type svc-id;
+ description
+ "Unique identifier for
+ the policy entry.";
+ }
+ container filter {
+ choice lan {
+ case lan-prefix {
+ container lan-prefixes {
+ list ipv4-lan-prefixes {
+ if-feature ipv4;
+ key lan;
+
+ leaf lan {
+ type inet:ipv4-prefix;
+ description
+ "Lan prefixes.";
+ }
+ description "
+ List of LAN prefixes
+ for the site.
+ ";
+ }
+ list ipv6-lan-prefixes {
+ if-feature ipv6;
+ key lan;
+
+ leaf lan {
+ type inet:ipv6-prefix;
+ description
+ "Lan prefixes.";
+ }
+ description "
+ List of LAN prefixes
+ for the site.
+ ";
+ }
+ description
+ "LAN prefixes from the customer.";
+ }
+ }
+ case lan-tag {
+ leaf-list lan-tag {
+ type string;
+ description
+ "List of lan-tags to be matched.";
+ }
+ }
+ description
+ "Choice for LAN matching type";
+ }
+ description
+ "If used, it permit to split site LANs
+ among multiple VPNs.
+ If no filter used, all the LANs will be
+ part of the same VPNs with the same
+ role.";
+ }
+ container vpn {
+ leaf vpn-id {
+ type leafref {
+ path "/l3vpn-svc/vpn-services/vpn-svc/vpn-id";
+ }
+ mandatory true;
+ description
+ "Reference to an IPVPN.";
+ }
+ leaf site-role {
+ type identityref {
+ base site-role;
+ }
+ mandatory true;
+ description
+ "Role of the site in the IPVPN.";
+ }
+ description
+ "List of VPNs the LAN is associated to.";
+ }
+ description
+ "List of entries for export policy.";
+ }
+ description
+ "List of VPN policies.";
+ }
+ description
+ "VPN policy.";
+ }
+ description
+ "VPN policy parameters for the site.";
+ }
+
+ grouping site-maximum-routes {
+ container maximum-routes {
+ list address-family {
+ key af;
+
+ leaf af {
+ type identityref {
+ base address-family;
+ }
+ description
+ "Address-family.";
+ }
+ leaf maximum-routes {
+ type uint32;
+ description
+ "Maximum prefixes the VRF can
+ accept for this
+ address-family.";
+ }
+ description
+ "List of address families.";
+ }
+
+ description
+ "Define maximum-routes for the VRF.";
+ }
+ description
+ "Define maximum-routes for the site.";
+ }
+
+ grouping site-security {
+ container security {
+ uses site-security-authentication;
+ uses site-security-encryption;
+
+ description
+ "Site specific security parameters.";
+ }
+ description
+ "Grouping for security parameters.";
+ }
+
+ grouping site-service {
+ container service {
+ uses site-service-basic;
+ uses site-service-qos-profile;
+ uses site-service-mpls;
+ uses site-service-multicast;
+
+ description
+ "Service parameters on the attachement.";
+ }
+ description
+ "Grouping for service parameters.";
+ }
+
+ grouping transport-constraint-profile {
+ list constraint-list {
+ key constraint-type;
+
+ leaf constraint-type {
+ type identityref {
+ base transport-constraint;
+ }
+ description
+ "Constraint type to be applied.";
+ }
+ leaf constraint-opaque-value {
+ type string;
+ description
+ "Opaque value that can be used to
+ specify constraint parameters.";
+ }
+ description
+ "List of constraints";
+ }
+ description
+ "Grouping for transport constraint.";
+ }
+
+ grouping transport-constraints {
+ container transport-constraints {
+ if-feature traffic-engineering;
+ container unicast-transport-constraints {
+ list constraint {
+ key constraint-id;
+
+ leaf constraint-id {
+ type svc-id;
+ description
+ "Defines an ID for the constraint
+ rule.";
+ }
+
+ leaf site1 {
+ type svc-id;
+ description
+ "The ID refers to one site end.";
+ }
+ leaf site2 {
+ type svc-id;
+ description
+ "The ID refers to the other
+ site end.";
+ }
+ uses transport-constraint-profile;
+ description
+ "List of constraints.
+ Constraints are bidirectional.";
+ }
+ description
+ "Unicast transport constraints.";
+ }
+ container multicast-transport-constraints {
+ if-feature traffic-engineering-multicast;
+ list constraint {
+ key constraint-id;
+
+ leaf constraint-id {
+ type svc-id;
+ description
+ "Defines an ID for the constraint
+ rule.";
+ }
+
+ leaf src-site {
+ type svc-id;
+ description
+ "The ID refers to source site.";
+ }
+ leaf dst-site {
+ type svc-id;
+ description
+ "The ID refers to the receiver
+ site.";
+ }
+ uses transport-constraint-profile;
+ description
+ "List of constraints.
+ Constraints are unidirectional.";
+ }
+ description
+ "Multicast transport constraints.";
+ }
+ description
+ "transport constraints.";
+ }
+ description
+ "Grouping for transport constraints
+ description.";
+ }
+
+ grouping vpn-extranet {
+ container extranet-vpns {
+ if-feature extranet-vpn;
+ list extranet-vpn {
+ key vpn-id;
+
+ leaf vpn-id {
+ type svc-id;
+ description
+ "Identifies the target VPN";
+ }
+ leaf local-sites-role {
+ type identityref {
+ base site-role;
+ }
+ description
+ "This describes the role of the
+ local sites in the target VPN topology.";
+ }
+ description
+ "List of extranet VPNs the local
+ VPN is attached to.";
+ }
+ description
+ "Container for extranet vpn cfg.";
+ }
+ description
+ "grouping for extranet VPN configuration.
+ Extranet provides a way to interconnect all sites
+ from two VPNs in a easy way.";
+ }
+
+ grouping site-attachment-availability {
+ container availability {
+ leaf access-priority {
+ type uint32;
+ default 1;
+ description
+ "Defines the priority for the access.
+ The highest the priority value is,
+ the highest the
+ preference of the access is.";
+ }
+ description
+ "Availability parameters
+ (used for multihoming)";
+ }
+ description
+ "Defines site availability parameters.";
+ }
+
+ grouping access-vpn-policy {
+ container vpn-attachment {
+ choice attachment-flavor {
+ case vpn-policy-id { /* this is not used */
+ leaf vpn-policy-id {
+ type leafref {
+ path "/l3vpn-svc/sites/site/"+
+ "vpn-policy-list/vpn-policy/"+
+ "vpn-policy-id";
+ }
+ description
+ "Reference to a VPN policy.";
+ }
+ }
+ case vpn-id { /* this is used */
+ leaf vpn-id {
+ type leafref {
+ path "/l3vpn-svc/vpn-services"+
+ "/vpn-svc/vpn-id";
+ }
+ description
+ "Reference to a VPN.";
+ }
+ leaf site-role {
+ type identityref {
+ base site-role;
+ }
+ mandatory true;
+ description
+ "Role of the site in the IPVPN.";
+ }
+ }
+ mandatory true;
+ description
+ "Choice for VPN attachment flavor.";
+ }
+ description
+ "Defines VPN attachment of a site.";
+ }
+ description
+ "Defines the VPN attachment rules
+ for a site logical access.";
+ }
+
+ grouping vpn-svc-cfg {
+ leaf vpn-id {
+ type svc-id;
+ description
+ "VPN identifier. Local administration meaning.";
+ }
+ leaf customer-name {
+ type string;
+ description
+ "Name of the customer.";
+ }
+ leaf topology {
+ type identityref {
+ base vpn-topology;
+ }
+ default "any-to-any";
+ description
+ "VPN topology.";
+ }
+
+ uses vpn-service-cloud-access;
+ uses vpn-service-multicast;
+ uses vpn-service-mpls;
+ uses transport-constraints;
+ uses vpn-extranet;
+ }
+
+ grouping site-top-level-cfg {
+ uses operational-requirements; // done /* Not used*/
+ uses customer-location-info; // done
+ uses site-diversity; // done
+ uses site-management; // done
+ uses site-vpn-policy; // done
+ uses site-vpn-flavor-profile; // done
+ uses site-maximum-routes; // done
+ uses site-security; // done
+ uses site-service;
+ uses site-protection;
+ uses site-routing; /*Will be used later*/
+
+ description
+ "Grouping for site top level cfg.";
+ }
+
+ grouping site-network-access-top-level-cfg {
+ leaf site-network-access-type { /* this is not used*/
+ type identityref {
+ base site-network-access-type;
+ }
+ default "point-to-point";
+ description
+ "Describes the type of connection, e.g. :
+ point-to-point or multipoint";
+ }
+ uses access-diversity; /* this is not used*/
+ uses site-attachment-bearer; /* this is used*/
+ uses site-attachment-ip-connection; /* this is used*/
+ uses site-security; /* this is not used*/
+ uses site-service; /* this is not used*/
+ uses site-routing; /* this is used*/
+ uses site-attachment-availability; /* this is not used*/
+ uses access-vpn-policy; /* this is used*/
+
+ description
+ "Grouping for site network access
+ top level cfg.";
+ }
+
+ /* Main blocks */
+
+ container l3vpn-svc {
+ container vpn-services {
+ list vpn-svc {
+ key vpn-id;
+
+ uses vpn-svc-cfg; /*Not used*/
+
+ description "
+ List of VPN services.";
+ }
+ description
+ "top level container
+ for the VPN services.";
+ }
+
+ container sites {
+ list site {
+ key site-id;
+
+ leaf site-id {
+ type svc-id;
+ }
+
+ uses site-top-level-cfg; /*Will be used later*/
+ uses operational-requirements-ops; /* Not used*/
+
+ container site-network-accesses { /* this is used*/
+ list site-network-access {
+ key site-network-access-id;
+
+ leaf site-network-access-id {
+ type svc-id;
+ }
+ uses site-network-access-top-level-cfg;
+ /* this is used*/
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/runtime/src/test/resources/l3vpn/l3vpn-svc-ext@2016-07-30.yang b/runtime/src/test/resources/l3vpn/l3vpn-svc-ext@2016-07-30.yang
new file mode 100644
index 0000000..9f92af6
--- /dev/null
+++ b/runtime/src/test/resources/l3vpn/l3vpn-svc-ext@2016-07-30.yang
@@ -0,0 +1,362 @@
+module l3vpn-svc-ext {
+ yang-version 1;
+ namespace "urn:ietf:params:xml:ns:yang:l3vpn:svc:ext";
+ prefix "l3vpn-svc-ext";
+
+ import yrt-ietf-inet-types { prefix inet; }
+ import ietf-l3vpn-svc { prefix l3vpn; }
+
+ revision 2016-07-30 {
+ description
+ "Eliminated warnings";
+ }
+
+ revision "2016-07-20" {
+ description "Initial revision of extended l3vpn yang model";
+ }
+
+ typedef short-as-number {
+ type inet:as-number {
+ range 0..65535;
+ }
+ }
+
+ typedef route-distinguisher {
+ reference "https://tools.ietf.org/html/rfc4364#section-4.2";
+ type union {
+ type rd-ipv4;
+ type rd-as;
+ type rd-as2;
+ }
+ }
+
+ typedef rd-ipv4 {
+ type string {
+ /* IPv4 : 2B number */
+ pattern '((([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}'
+ + '([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5]))'
+ + ':'
+ + '([0-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|'
+ + '[1-5][0-9][0-9][0-9][0-9]|6[0-4][0-9][0-9][0-9]|'
+ + '65[0-4][0-9][0-9]|655[0-2][0-9]|6553[0-5])';
+ }
+ }
+
+ typedef rd-as {
+ type string {
+ /* 2B AS : 4B number */
+ pattern '([0-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|'
+ + '[1-5][0-9][0-9][0-9][0-9]|6[0-4][0-9][0-9][0-9]|'
+ + '65[0-4][0-9][0-9]|655[0-2][0-9]|6553[0-5])'
+ + ':'
+ + '([0-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|'
+ + '[1-9][0-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9][0-9]|'
+ + '[1-9][0-9][0-9][0-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]|'
+ + '[1-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]|[1-3][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]|'
+ + '4[0-1][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]|42[0-8][0-9][0-9][0-9][0-9][0-9][0-9][0-9]|'
+ + '429[0-3][0-9][0-9][0-9][0-9][0-9][0-9]|4294[0-8][0-9][0-9][0-9][0-9][0-9]|'
+ + '42949[0-5][0-9][0-9][0-9][0-9]|429496[0-6][0-9][0-9][0-9]|4294967[0-1][0-9][0-9]|'
+ + '42949672[0-8][0-9]|429496729[0-5])';
+ }
+ }
+
+ typedef rd-as2 {
+ type string {
+ /* 4B AS : 2B number */
+ pattern '([0-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|'
+ + '[1-9][0-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9][0-9]|'
+ + '[1-9][0-9][0-9][0-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]|'
+ + '[1-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]|[1-3][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]|'
+ + '4[0-1][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]|42[0-8][0-9][0-9][0-9][0-9][0-9][0-9][0-9]|'
+ + '429[0-3][0-9][0-9][0-9][0-9][0-9][0-9]|4294[0-8][0-9][0-9][0-9][0-9][0-9]|'
+ + '42949[0-5][0-9][0-9][0-9][0-9]|429496[0-6][0-9][0-9][0-9]|4294967[0-1][0-9][0-9]|'
+ + '42949672[0-8][0-9]|429496729[0-5])'
+ + ':'
+ + '([0-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|'
+ + '[1-5][0-9][0-9][0-9][0-9]|6[0-4][0-9][0-9][0-9]|'
+ + '65[0-4][0-9][0-9]|655[0-2][0-9]|6553[0-5])';
+ }
+ }
+
+ identity tc-demanded-tunnel {
+ base l3vpn:transport-constraint;
+ description "on-demand tunnel.";
+ }
+
+ grouping class-profile {
+ list qos-class {
+ key class-id;
+ leaf class-id {
+ type string;
+ description
+ "Identification of the
+ class of service.
+ This identifier is internal to
+ the administration.";
+ }
+ leaf rate-limit {
+ type uint8;
+ units percent;
+ description
+ "To be used if class must
+ be rate
+ limited. Expressed as
+ percentage of the svc-bw.";
+ }
+ leaf priority-level {
+ type uint8;
+ description
+ "Defines the level of the
+ class in
+ term of priority queueing.
+ The higher the level is the
+ higher
+ is the priority.";
+ }
+ leaf guaranteed-bw-percent {
+ type uint8;
+ units percent;
+ description
+ "To be used to define the
+ guaranteed
+ BW in percent of the svc-bw
+ available at the priority-level.";
+ }
+ description
+ "List of class of services.";
+ }
+ }
+
+ augment "/l3vpn:l3vpn-svc/l3vpn:sites/l3vpn:site/l3vpn:site-network-accesses/l3vpn:site-network-access/l3vpn:service/l3vpn:qos/l3vpn:qos-profile/l3vpn:qos-profile" {
+ case custom-unicom {
+ container inbound-classes {
+ uses class-profile;
+ }
+ container outbound-classes {
+ uses class-profile;
+ }
+ }
+ }
+
+ grouping bearer-attachment-grouping {
+ container bearer-attachment {
+ leaf pe-name {
+ type string;
+ }
+ leaf pe-mgmt-ip {
+ type inet:ipv4-address;
+ }
+ description "attached PE";
+ }
+ }
+
+ augment "/l3vpn:l3vpn-svc/l3vpn:sites/l3vpn:site/l3vpn:site-network-accesses/l3vpn:site-network-access/l3vpn:bearer" { //used
+ uses bearer-attachment-grouping;
+ }
+
+ grouping requested-type-grouping {
+ container requested-type-profile {
+ choice requested-type-choice {
+ case dot1q-case {
+ container dot1q {
+ leaf physical-if {
+ description "physical interface name.";
+ type string;
+ }
+ leaf vlan-id {
+ type uint16 {
+ range "1..4096";
+ }
+ }
+ }
+ }
+ case physical-case {
+ container physical {
+ leaf physical-if {
+ description "physical interface name.";
+ type string;
+ }
+ }
+ }
+ }
+ leaf circuit-id {
+ description "circuit description for PE-CE port.";
+ type string;
+ }
+ }
+ }
+
+ augment "/l3vpn:l3vpn-svc/l3vpn:sites/l3vpn:site/l3vpn:site-network-accesses/l3vpn:site-network-access/l3vpn:bearer/l3vpn:requested-type" { //used
+ uses requested-type-grouping;
+ }
+
+ grouping bfd-grouping {
+ leaf bfd-enabled {
+ type boolean;
+ description
+ "BFD activation";
+ }
+ choice holdtime {
+ case profile {
+ leaf profile-name {
+ type string;
+ description
+ "Service provider well
+ known profile.";
+ }
+ description
+ "Service provider well
+ known profile.";
+ }
+ case fixed {
+ leaf fixed-value {
+ type uint32;
+ units msec;
+ description
+ "Expected holdtime
+ expressed
+ in msec.";
+ }
+ }
+ case dynamic {
+ container dynamic-value {
+ leaf interval {
+ type uint16;
+ units msec;
+ default 500;
+ }
+ leaf multiplier {
+ type uint16;
+ default 3;
+ }
+ description
+ "interval * multiplier is
+ timeout value.";
+ }
+ }
+ }
+ }
+
+ grouping bgp-profile {
+ leaf as-override {
+ type boolean;
+ default false;
+ }
+ container soo {
+ leaf soo-enabled {
+ type boolean;
+ }
+ leaf soo-value {
+ type string;
+ }
+ }
+ container password {
+ leaf password-enabled {
+ type boolean;
+ }
+ leaf password-value {
+ type string;
+ }
+ }
+ container bgp-timer {
+ leaf keep-alive {
+ type uint16;
+ default 60;
+ units "seconds";
+ }
+ leaf hold-time {
+ type uint16;
+ default 180;
+ units "seconds";
+ }
+ }
+ container bfd {
+ uses bfd-grouping;
+ }
+ }
+
+ augment "/l3vpn:l3vpn-svc/l3vpn:sites/l3vpn:site/l3vpn:site-network-accesses/l3vpn:site-network-access/l3vpn:routing-protocols/l3vpn:routing-protocol/l3vpn:bgp" {
+ uses bgp-profile;
+ }
+
+ augment "/l3vpn:l3vpn-svc/l3vpn:vpn-services/l3vpn:vpn-svc/l3vpn:transport-constraints/l3vpn:unicast-transport-constraints/l3vpn:constraint/l3vpn:constraint-list" {
+ leaf constraint-opaque-value2 {
+ type string;
+ description
+ "Opaque value that can be used to
+ specify constraint parameters.";
+ }
+ }
+
+ grouping route-ipv4-extended-community {
+ reference "http://tools.ietf.org/html/rfc4360";
+ leaf global-administrator {
+ type inet:ipv4-address;
+ }
+ leaf local-administrator {
+ type uint16;
+ }
+ }
+
+ grouping extended-community {
+ choice extended-community {
+ reference "http://tools.ietf.org/html/rfc4360#section-4";
+ default route-target-extended-community-case;
+ case route-target-extended-community-case {
+ container route-target-extended-community {
+ leaf global-administrator {
+ type short-as-number;
+ }
+ leaf local-administrator {
+ type uint32;
+ }
+ }
+ }
+ case route-target-ipv4-case {
+ container route-target-ipv4 {
+ uses route-ipv4-extended-community;
+ }
+ }
+ case route-target-extended-community-case2 {
+ container route-target-extended-community2 {
+ leaf global-administrator {
+ type uint32;
+ }
+ leaf local-administrator {
+ type uint16;
+ }
+ }
+ }
+ }
+ }
+
+ grouping rdrt-profile {
+ choice site-role {
+ case custom-case {
+ container custom {
+ list import-rt {
+ key imrt-id;
+ leaf imrt-id {
+ type string;
+ }
+ uses extended-community;
+ }
+ list export-rt {
+ key exrt-id;
+ leaf exrt-id {
+ type string;
+ }
+ uses extended-community;
+ }
+ leaf rd {
+ type route-distinguisher;
+ }
+ }
+ }
+ }
+ }
+
+ augment "/l3vpn:l3vpn-svc/l3vpn:sites/l3vpn:site/l3vpn:site-network-accesses/l3vpn:site-network-access/l3vpn:vpn-attachment" {
+ uses rdrt-profile;
+ }
+}
\ No newline at end of file