summaryrefslogtreecommitdiffstats
path: root/v3po/v3po2vpp/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'v3po/v3po2vpp/src/main')
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/initializers/InterfacesInitializer.java66
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/initializers/SubInterfaceInitializationUtils.java8
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/initializers/VppClasifierInitializer.java46
-rw-r--r--v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/VppClassifierConfigurationInitializerModule.java24
-rw-r--r--v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/VppClassifierConfigurationInitializerModuleFactory.java13
-rw-r--r--v3po/v3po2vpp/src/main/yang/v3po2vpp.yang21
6 files changed, 153 insertions, 25 deletions
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/initializers/InterfacesInitializer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/initializers/InterfacesInitializer.java
index 5941710fa..d4e41be76 100644
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/initializers/InterfacesInitializer.java
+++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/initializers/InterfacesInitializer.java
@@ -47,12 +47,14 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.VppInterfaceStateAugmentation;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.VxlanGpeVni;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.VxlanVni;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.interfaces._interface.AclBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.interfaces._interface.EthernetBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.interfaces._interface.L2Builder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.interfaces._interface.TapBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.interfaces._interface.VhostUserBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.interfaces._interface.VxlanBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.interfaces._interface.VxlanGpeBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.interfaces.state._interface.Acl;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.interfaces.state._interface.Ethernet;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.interfaces.state._interface.L2;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.v3po.rev150105.interfaces.state._interface.Tap;
@@ -76,7 +78,7 @@ public class InterfacesInitializer extends AbstractDataTreeConverter<InterfacesS
public InterfacesInitializer(@Nonnull final DataBroker bindingDataBroker) {
super(bindingDataBroker, InstanceIdentifier.create(InterfacesState.class),
- InstanceIdentifier.create(Interfaces.class));
+ InstanceIdentifier.create(Interfaces.class));
}
@Override
@@ -110,44 +112,49 @@ public class InterfacesInitializer extends AbstractDataTreeConverter<InterfacesS
}
private static void initializeVppInterfaceStateAugmentation(
- final org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface input,
- final InterfaceBuilder builder) {
+ final org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface input,
+ final InterfaceBuilder builder) {
final VppInterfaceStateAugmentation vppIfcAugmentation =
- input.getAugmentation(VppInterfaceStateAugmentation.class);
- if(vppIfcAugmentation != null) {
+ input.getAugmentation(VppInterfaceStateAugmentation.class);
+ if (vppIfcAugmentation != null) {
final VppInterfaceAugmentationBuilder augmentBuilder = new VppInterfaceAugmentationBuilder();
builder.setDescription(vppIfcAugmentation.getDescription());
final Vxlan vxlan = vppIfcAugmentation.getVxlan();
- if(vxlan != null) {
+ if (vxlan != null) {
setVxlan(augmentBuilder, vxlan);
}
final VxlanGpe vxlanGpe = vppIfcAugmentation.getVxlanGpe();
- if(vxlanGpe != null) {
+ if (vxlanGpe != null) {
setVxlanGpe(augmentBuilder, vxlanGpe);
}
final Tap tap = vppIfcAugmentation.getTap();
- if(tap != null) {
+ if (tap != null) {
setTap(input, augmentBuilder, tap);
}
final VhostUser vhostUser = vppIfcAugmentation.getVhostUser();
- if(vhostUser != null) {
+ if (vhostUser != null) {
setVhostUser(augmentBuilder, vhostUser);
}
final L2 l2 = vppIfcAugmentation.getL2();
- if(l2 != null) {
+ if (l2 != null) {
setL2(augmentBuilder, l2);
}
final Ethernet ethernet = vppIfcAugmentation.getEthernet();
- if(ethernet != null) {
+ if (ethernet != null) {
setEthernet(augmentBuilder, ethernet);
}
+ final Acl acl = vppIfcAugmentation.getAcl();
+ if (acl != null) {
+ setAcl(augmentBuilder, acl);
+ }
+
// TODO set routing, not present in interface-state
builder.addAugmentation(VppInterfaceAugmentation.class, augmentBuilder.build());
@@ -155,27 +162,28 @@ public class InterfacesInitializer extends AbstractDataTreeConverter<InterfacesS
}
private static void initializeIetfIpAugmentation(
- final org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface input,
- final InterfaceBuilder builder) {
+ final org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface input,
+ final InterfaceBuilder builder) {
final Interface2 ietfIpAugmentation = input.getAugmentation(Interface2.class);
- if(ietfIpAugmentation != null) {
+ if (ietfIpAugmentation != null) {
final Interface1Builder augmentBuilder = new Interface1Builder();
final Ipv4 ipv4 = ietfIpAugmentation.getIpv4();
if (ipv4 != null) {
final List<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces._interface.ipv4.Address>
- collect =
- ipv4.getAddress().stream()
- .map(address -> new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces._interface.ipv4.AddressBuilder()
- .setIp(address.getIp())
- .setSubnet(getSubnet(address))
- .build())
- .collect(Collectors.toList());
+ collect =
+ ipv4.getAddress().stream()
+ .map(
+ address -> new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces._interface.ipv4.AddressBuilder()
+ .setIp(address.getIp())
+ .setSubnet(getSubnet(address))
+ .build())
+ .collect(Collectors.toList());
final List<Neighbor> neighbors = ipv4.getNeighbor().stream()
- .map(neighbor -> new NeighborBuilder().setIp(neighbor.getIp())
- .setLinkLayerAddress(neighbor.getLinkLayerAddress()).build())
- .collect(Collectors.toList());
+ .map(neighbor -> new NeighborBuilder().setIp(neighbor.getIp())
+ .setLinkLayerAddress(neighbor.getLinkLayerAddress()).build())
+ .collect(Collectors.toList());
augmentBuilder.setIpv4(new Ipv4Builder().setAddress(collect).setNeighbor(neighbors).build());
}
@@ -205,11 +213,19 @@ public class InterfacesInitializer extends AbstractDataTreeConverter<InterfacesS
augmentBuilder.setEthernet(ethernetBuilder.build());
}
+ private static void setAcl(final VppInterfaceAugmentationBuilder augmentBuilder, final Acl acl) {
+ final AclBuilder aclBuilder = new AclBuilder();
+ aclBuilder.setL2Acl(acl.getL2Acl());
+ aclBuilder.setIp4Acl(acl.getIp4Acl());
+ aclBuilder.setIp6Acl(acl.getIp6Acl());
+ augmentBuilder.setAcl(aclBuilder.build());
+ }
+
private static void setL2(final VppInterfaceAugmentationBuilder augmentBuilder, final L2 l2) {
final L2Builder l2Builder = new L2Builder();
final Interconnection interconnection = l2.getInterconnection();
- if(interconnection != null) {
+ if (interconnection != null) {
if (interconnection instanceof XconnectBased) {
final XconnectBasedBuilder xconnectBasedBuilder = new XconnectBasedBuilder();
xconnectBasedBuilder.setXconnectOutgoingInterface(
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/initializers/SubInterfaceInitializationUtils.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/initializers/SubInterfaceInitializationUtils.java
index 2d2217430..51adcc8f5 100644
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/initializers/SubInterfaceInitializationUtils.java
+++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/initializers/SubInterfaceInitializationUtils.java
@@ -24,6 +24,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev150527.interfaces._interface.sub.interfaces.SubInterfaceKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev150527.interfaces.state._interface.SubInterfaces;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev150527.interfaces.state._interface.sub.interfaces.SubInterface;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev150527.sub._interface.base.attributes.AclBuilder;
/**
* Utility class for sub interface initialization
@@ -76,6 +77,13 @@ final class SubInterfaceInitializationUtils {
subInterfaceCfgBuilder.setVlanType(operationalData.getVlanType());
subInterfaceCfgBuilder.setIpv4(operationalData.getIpv4());
subInterfaceCfgBuilder.setIpv6(operationalData.getIpv6());
+
+ final AclBuilder aclBuilder = new AclBuilder();
+ aclBuilder.setL2Acl(operationalData.getAcl().getL2Acl());
+ aclBuilder.setIp4Acl(operationalData.getAcl().getIp4Acl());
+ aclBuilder.setIp6Acl(operationalData.getAcl().getIp6Acl());
+ subInterfaceCfgBuilder.setAcl(aclBuilder.build());
+
return subInterfaceCfgBuilder.build();
}
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/initializers/VppClasifierInitializer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/initializers/VppClasifierInitializer.java
new file mode 100644
index 000000000..b903d3b10
--- /dev/null
+++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/initializers/VppClasifierInitializer.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2016 Cisco and/or its affiliates.
+ *
+ * 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 io.fd.honeycomb.v3po.translate.v3po.initializers;
+
+import io.fd.honeycomb.v3po.vpp.data.init.AbstractDataTreeConverter;
+import java.util.stream.Collectors;
+import javax.annotation.Nonnull;
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev150603.VppClassifier;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev150603.VppClassifierBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.classifier.rev150603.vpp.classifier.ClassifyTableBuilder;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+
+/**
+ * Initializes vpp-classfier node in config data tree based on operational state.
+ */
+public class VppClasifierInitializer extends AbstractDataTreeConverter<VppClassifier, VppClassifier> {
+ private static final InstanceIdentifier<VppClassifier> ID = InstanceIdentifier.create(VppClassifier.class);
+
+ public VppClasifierInitializer(@Nonnull final DataBroker bindingDataBroker) {
+ super(bindingDataBroker, ID, ID);
+ }
+
+ @Override
+ protected VppClassifier convert(final VppClassifier operationalData) {
+ final VppClassifierBuilder builder = new VppClassifierBuilder();
+ builder.setClassifyTable(operationalData.getClassifyTable().stream()
+ .map(oper -> new ClassifyTableBuilder(oper).setActiveSessions(null).build())
+ .collect(Collectors.toList()));
+ return builder.build();
+ }
+}
diff --git a/v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/VppClassifierConfigurationInitializerModule.java b/v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/VppClassifierConfigurationInitializerModule.java
new file mode 100644
index 000000000..ce29697cc
--- /dev/null
+++ b/v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/VppClassifierConfigurationInitializerModule.java
@@ -0,0 +1,24 @@
+package org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.v3po2vpp.rev160406;
+
+import io.fd.honeycomb.v3po.translate.v3po.initializers.VppClasifierInitializer;
+
+public class VppClassifierConfigurationInitializerModule extends org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.v3po2vpp.rev160406.AbstractVppClassifierConfigurationInitializerModule {
+ public VppClassifierConfigurationInitializerModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
+ super(identifier, dependencyResolver);
+ }
+
+ public VppClassifierConfigurationInitializerModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.v3po2vpp.rev160406.VppClassifierConfigurationInitializerModule oldModule, java.lang.AutoCloseable oldInstance) {
+ super(identifier, dependencyResolver, oldModule, oldInstance);
+ }
+
+ @Override
+ public void customValidation() {
+ // add custom validation form module attributes here.
+ }
+
+ @Override
+ public java.lang.AutoCloseable createInstance() {
+ return new VppClasifierInitializer(getBindingDataBrokerDependency());
+ }
+
+}
diff --git a/v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/VppClassifierConfigurationInitializerModuleFactory.java b/v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/VppClassifierConfigurationInitializerModuleFactory.java
new file mode 100644
index 000000000..4e0e7c79e
--- /dev/null
+++ b/v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/VppClassifierConfigurationInitializerModuleFactory.java
@@ -0,0 +1,13 @@
+/*
+* Generated file
+*
+* Generated from: yang module name: v3po2vpp yang module local name: vpp-classifier-cfg-initializer
+* Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
+* Generated at: Thu Jul 14 16:02:24 CEST 2016
+*
+* Do not modify this file unless it is present under src/main directory
+*/
+package org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.v3po2vpp.rev160406;
+public class VppClassifierConfigurationInitializerModuleFactory extends org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.v3po2vpp.rev160406.AbstractVppClassifierConfigurationInitializerModuleFactory {
+
+}
diff --git a/v3po/v3po2vpp/src/main/yang/v3po2vpp.yang b/v3po/v3po2vpp/src/main/yang/v3po2vpp.yang
index f70d3f8b1..bc10e7691 100644
--- a/v3po/v3po2vpp/src/main/yang/v3po2vpp.yang
+++ b/v3po/v3po2vpp/src/main/yang/v3po2vpp.yang
@@ -342,5 +342,26 @@ module v3po2vpp {
}
}
+ identity vpp-classifier-cfg-initializer {
+ base config:module-type;
+ config:provided-service init:cfg-initializer;
+ config:java-name-prefix VppClassifierConfigurationInitializer;
+ }
+
+ augment "/config:modules/config:module/config:configuration" {
+ case vpp-classifier-cfg-initializer {
+ when "/config:modules/config:module/config:type = 'vpp-classifier-cfg-initializer'";
+
+ container binding-data-broker {
+ uses config:service-ref {
+ refine type {
+ mandatory true;
+ config:required-identity md-sal-binding:binding-async-data-broker;
+ }
+ }
+ }
+ }
+ }
+
} \ No newline at end of file