summaryrefslogtreecommitdiffstats
path: root/v3po/v3po2vpp/src/main
diff options
context:
space:
mode:
authorMaros Marsalek <mmarsale@cisco.com>2016-07-04 16:55:22 +0200
committerMaros Marsalek <mmarsale@cisco.com>2016-07-13 11:43:31 +0200
commit7bb99b94d45e3fbb677dab74bdda7bd0d22391a9 (patch)
tree124077b880b1ec2f6b4adc07be65228332cabf13 /v3po/v3po2vpp/src/main
parent40da600c311b18c628410af5f795c25c6e248cf6 (diff)
HONEYCOMB-81 Fix v3po2vpp writer order
Now fully persisted configuration can be restored when VPP and HC restart Change-Id: I6ad146da004044f643925208f8951e8eb8e87627 Signed-off-by: Maros Marsalek <mmarsale@cisco.com>
Diffstat (limited to 'v3po/v3po2vpp/src/main')
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/vppstate/L2FibEntryCustomizer.java5
-rw-r--r--v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/InterfacesHoneycombWriterModule.java34
-rw-r--r--v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/Readme.adoc30
-rw-r--r--v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/SubinterfaceAugmentationWriterFactory.java33
-rw-r--r--v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/VppHoneycombWriterModule.java8
5 files changed, 74 insertions, 36 deletions
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/vppstate/L2FibEntryCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/vppstate/L2FibEntryCustomizer.java
index 93cc9e448..dcd9c7341 100644
--- a/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/vppstate/L2FibEntryCustomizer.java
+++ b/v3po/v3po2vpp/src/main/java/io/fd/honeycomb/v3po/translate/v3po/vppstate/L2FibEntryCustomizer.java
@@ -133,8 +133,9 @@ public final class L2FibEntryCustomizer extends FutureJVppCustomizer
LOG.debug("Reading L2 FIB for bridge domain {} (bdId={})", bridgeDomainKey, bdId);
try {
return dumpL2Fibs(id, bdId).stream()
- .map(entry -> new L2FibEntryKey(new PhysAddress(vppPhysAddrToYang(Longs.toByteArray(entry.mac), 2)))
- ).collect(Collectors.toList());
+ .map(entry -> new L2FibEntryKey(
+ new PhysAddress(vppPhysAddrToYang(Longs.toByteArray(entry.mac), 2))))
+ .collect(Collectors.toList());
} catch (VppBaseCallException e) {
throw new ReadFailedException(id, e);
}
diff --git a/v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/InterfacesHoneycombWriterModule.java b/v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/InterfacesHoneycombWriterModule.java
index 8cc740a48..2d440cdd5 100644
--- a/v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/InterfacesHoneycombWriterModule.java
+++ b/v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/InterfacesHoneycombWriterModule.java
@@ -39,6 +39,15 @@ import org.openvpp.jvpp.future.FutureJVpp;
public class InterfacesHoneycombWriterModule extends
org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.v3po2vpp.rev160406.AbstractInterfacesHoneycombWriterModule {
+
+ // TODO split configuration and translation code into 2 or more bundles
+
+ public static final InstanceIdentifier<Interface> IFC_ID =
+ InstanceIdentifier.create(Interfaces.class).child(Interface.class);
+ public static final InstanceIdentifier<VppInterfaceAugmentation> VPP_IFC_AUG_ID =
+ IFC_ID.augmentation(VppInterfaceAugmentation.class);
+ public static final InstanceIdentifier<L2> L2_ID = VPP_IFC_AUG_ID.child(L2.class);
+
public InterfacesHoneycombWriterModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier,
org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
super(identifier, dependencyResolver);
@@ -87,14 +96,13 @@ public class InterfacesHoneycombWriterModule extends
public void init(final ModifiableWriterRegistry registry) {
// Interfaces
// Interface =
- final InstanceIdentifier<Interface> ifcId = InstanceIdentifier.create(Interfaces.class).child(Interface.class);
- registry.addWriter(new GenericListWriter<>(ifcId, new InterfaceCustomizer(jvpp, ifcContext)));
+ registry.addWriter(new GenericListWriter<>(IFC_ID, new InterfaceCustomizer(jvpp, ifcContext)));
// VppInterfaceAugmentation
- addVppInterfaceAgmentationWriters(ifcId, registry);
+ addVppInterfaceAgmentationWriters(IFC_ID, registry);
// Interface1 (ietf-ip augmentation)
- addInterface1AugmentationWriters(ifcId, registry);
+ addInterface1AugmentationWriters(IFC_ID, registry);
// SubinterfaceAugmentation TODO make dedicated module for subIfc writer factory
- new SubinterfaceAugmentationWriterFactory(ifcId, jvpp, ifcContext, bdContext).init(registry);
+ new SubinterfaceAugmentationWriterFactory(jvpp, ifcContext, bdContext).init(registry);
}
private void addInterface1AugmentationWriters(final InstanceIdentifier<Interface> ifcId,
@@ -118,35 +126,33 @@ public class InterfacesHoneycombWriterModule extends
private void addVppInterfaceAgmentationWriters(final InstanceIdentifier<Interface> ifcId,
final ModifiableWriterRegistry registry) {
- final InstanceIdentifier<VppInterfaceAugmentation> vppIfcAugId = ifcId.augmentation(VppInterfaceAugmentation.class);
// VhostUser(Needs to be executed before Interface customizer) =
- final InstanceIdentifier<VhostUser> vhostId = vppIfcAugId.child(VhostUser.class);
+ final InstanceIdentifier<VhostUser> vhostId = VPP_IFC_AUG_ID.child(VhostUser.class);
registry.addWriterBefore(new GenericWriter<>(vhostId, new VhostUserCustomizer(jvpp, ifcContext)),
ifcId);
// Vxlan(Needs to be executed before Interface customizer) =
- final InstanceIdentifier<Vxlan> vxlanId = vppIfcAugId.child(Vxlan.class);
+ final InstanceIdentifier<Vxlan> vxlanId = VPP_IFC_AUG_ID.child(Vxlan.class);
registry.addWriterBefore(new GenericWriter<>(vxlanId, new VxlanCustomizer(jvpp, ifcContext)),
ifcId);
// VxlanGpe(Needs to be executed before Interface customizer) =
- final InstanceIdentifier<VxlanGpe> vxlanGpeId = vppIfcAugId.child(VxlanGpe.class);
+ final InstanceIdentifier<VxlanGpe> vxlanGpeId = VPP_IFC_AUG_ID.child(VxlanGpe.class);
registry.addWriterBefore(new GenericWriter<>(vxlanGpeId, new VxlanGpeCustomizer(jvpp, ifcContext)),
ifcId);
// Tap(Needs to be executed before Interface customizer) =
- final InstanceIdentifier<Tap> tapId = vppIfcAugId.child(Tap.class);
+ final InstanceIdentifier<Tap> tapId = VPP_IFC_AUG_ID.child(Tap.class);
registry.addWriterBefore(new GenericWriter<>(tapId, new TapCustomizer(jvpp, ifcContext)),
ifcId);
final Set<InstanceIdentifier<?>> specificIfcTypes = Sets.newHashSet(vhostId, vxlanGpeId, vxlanGpeId, tapId);
// Ethernet(No dependency, customizer not finished TODO) =
- registry.addWriter(new GenericWriter<>(vppIfcAugId.child(Ethernet.class), new EthernetCustomizer(jvpp)));
+ registry.addWriter(new GenericWriter<>(VPP_IFC_AUG_ID.child(Ethernet.class), new EthernetCustomizer(jvpp)));
// Routing(Execute only after specific interface customizers) =
registry.addWriterAfter(
- new GenericWriter<>(vppIfcAugId.child(Routing.class), new RoutingCustomizer(jvpp, ifcContext)),
+ new GenericWriter<>(VPP_IFC_AUG_ID.child(Routing.class), new RoutingCustomizer(jvpp, ifcContext)),
specificIfcTypes);
// Routing(Execute only after specific interface customizers) =
- registry.addWriterAfter(
- new GenericWriter<>(vppIfcAugId.child(L2.class), new L2Customizer(jvpp, ifcContext, bdContext)),
+ registry.addWriterAfter(new GenericWriter<>(L2_ID, new L2Customizer(jvpp, ifcContext, bdContext)),
specificIfcTypes);
}
diff --git a/v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/Readme.adoc b/v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/Readme.adoc
new file mode 100644
index 000000000..8917105f5
--- /dev/null
+++ b/v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/Readme.adoc
@@ -0,0 +1,30 @@
+= V3po2vpp
+V3po2vpp contains v3po-api's handlers (writer/reader) registration into HC infrastructure
+
+== Writers
+Current order of v3po-api writers is:
+
+. BridgeDomain
+. VhostUser
+. VxlanGpe
+. Tap
+. Vxlan
+. Interface
+. L2
+. SubInterface
+. L2
+. Ethernet
+. Routing
+. Ipv6
+. Ipv4
+. Address
+. Neighbor
+. L2FibEntry
+. Rewrite
+. Address
+
+To find out current order in runtime, turn on logging for writer registry:
+
+ log:set TRACE io.fd.honeycomb.v3po.translate.util.write.registry
+
+== Readers \ No newline at end of file
diff --git a/v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/SubinterfaceAugmentationWriterFactory.java b/v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/SubinterfaceAugmentationWriterFactory.java
index 589ba92be..657769aad 100644
--- a/v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/SubinterfaceAugmentationWriterFactory.java
+++ b/v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/SubinterfaceAugmentationWriterFactory.java
@@ -27,11 +27,11 @@ import io.fd.honeycomb.v3po.translate.v3po.util.NamingContext;
import io.fd.honeycomb.v3po.translate.write.ModifiableWriterRegistry;
import io.fd.honeycomb.v3po.translate.write.WriterFactory;
import org.opendaylight.yang.gen.v1.urn.ieee.params.xml.ns.yang.dot1q.types.rev150626.dot1q.tag.or.any.Dot1qTag;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev150527.SubinterfaceAugmentation;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev150527.interfaces._interface.SubInterfaces;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev150527.interfaces._interface.sub.interfaces.SubInterface;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev150527.match.attributes.match.type.vlan.tagged.VlanTagged;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev150527.sub._interface.base.attributes.L2;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev150527.sub._interface.base.attributes.Match;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev150527.sub._interface.base.attributes.Tags;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev150527.sub._interface.base.attributes.l2.Rewrite;
@@ -44,15 +44,18 @@ import org.openvpp.jvpp.future.FutureJVpp;
final class SubinterfaceAugmentationWriterFactory implements WriterFactory {
- private final InstanceIdentifier<Interface> ifcId;
private final FutureJVpp jvpp;
private final NamingContext ifcContext;
private final NamingContext bdContext;
+ public static final InstanceIdentifier<SubinterfaceAugmentation> SUB_IFC_AUG_ID =
+ InterfacesHoneycombWriterModule.IFC_ID.augmentation(SubinterfaceAugmentation.class);
+ public static final InstanceIdentifier<SubInterface> SUB_IFC_ID =
+ SUB_IFC_AUG_ID.child(SubInterfaces.class).child(SubInterface.class);
+ public static final InstanceIdentifier<L2> L2_ID = SUB_IFC_ID.child(
+ L2.class);
- public SubinterfaceAugmentationWriterFactory(
- final InstanceIdentifier<Interface> ifcId, final FutureJVpp jvpp,
+ public SubinterfaceAugmentationWriterFactory(final FutureJVpp jvpp,
final NamingContext ifcContext, final NamingContext bdContext) {
- this.ifcId = ifcId;
this.jvpp = jvpp;
this.ifcContext = ifcContext;
this.bdContext = bdContext;
@@ -60,11 +63,8 @@ final class SubinterfaceAugmentationWriterFactory implements WriterFactory {
@Override
public void init(final ModifiableWriterRegistry registry) {
- final InstanceIdentifier<SubinterfaceAugmentation> subIfcAugId =
- ifcId.augmentation(SubinterfaceAugmentation.class);
// Subinterfaces
// Subinterface(Handle only after all interface related stuff gets processed) =
- final InstanceIdentifier<SubInterface> subIfcId = subIfcAugId.child(SubInterfaces.class).child(SubInterface.class);
registry.addSubtreeWriterAfter(
// TODO this customizer covers quite a lot of complex child nodes (maybe refactor ?)
Sets.newHashSet(
@@ -74,25 +74,22 @@ final class SubinterfaceAugmentationWriterFactory implements WriterFactory {
Dot1qTag.class),
InstanceIdentifier.create(SubInterface.class).child(Match.class),
InstanceIdentifier.create(SubInterface.class).child(Match.class).child(VlanTagged.class)),
- new GenericListWriter<>(subIfcId, new SubInterfaceCustomizer(jvpp, ifcContext)),
- ifcId);
+ new GenericListWriter<>(SUB_IFC_ID, new SubInterfaceCustomizer(jvpp, ifcContext)),
+ InterfacesHoneycombWriterModule.IFC_ID);
// L2 =
- final InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev150527.sub._interface.base.attributes.L2>
- l2Id = subIfcId.child(
- org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.vlan.rev150527.sub._interface.base.attributes.L2.class);
- registry.addWriterAfter(new GenericWriter<>(l2Id, new SubInterfaceL2Customizer(jvpp, ifcContext, bdContext)),
- subIfcId);
+ registry.addWriterAfter(new GenericWriter<>(L2_ID, new SubInterfaceL2Customizer(jvpp, ifcContext, bdContext)),
+ SUB_IFC_ID);
// Rewrite(also handles pushTags + pushTags/dot1qtag) =
- final InstanceIdentifier<Rewrite> rewriteId = l2Id.child(Rewrite.class);
+ final InstanceIdentifier<Rewrite> rewriteId = L2_ID.child(Rewrite.class);
registry.addSubtreeWriterAfter(
Sets.newHashSet(
InstanceIdentifier.create(Rewrite.class).child(PushTags.class),
InstanceIdentifier.create(Rewrite.class).child(PushTags.class)
.child(org.opendaylight.yang.gen.v1.urn.ieee.params.xml.ns.yang.dot1q.types.rev150626.dot1q.tag.Dot1qTag.class)),
new GenericWriter<>(rewriteId, new RewriteCustomizer(jvpp, ifcContext)),
- l2Id);
+ L2_ID);
// Ipv4(handled after L2 and L2/rewrite is done) =
- final InstanceIdentifier<Address> ipv4SubifcAddressId = subIfcId.child(Ipv4.class).child(Address.class);
+ final InstanceIdentifier<Address> ipv4SubifcAddressId = SUB_IFC_ID.child(Ipv4.class).child(Address.class);
registry.addWriterAfter(new GenericListWriter<>(ipv4SubifcAddressId,
new SubInterfaceIpv4AddressCustomizer(jvpp, ifcContext)),
rewriteId);
diff --git a/v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/VppHoneycombWriterModule.java b/v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/VppHoneycombWriterModule.java
index d9a542bde..922b6f9cd 100644
--- a/v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/VppHoneycombWriterModule.java
+++ b/v3po/v3po2vpp/src/main/java/org/opendaylight/yang/gen/v1/urn/honeycomb/params/xml/ns/yang/v3po2vpp/rev160406/VppHoneycombWriterModule.java
@@ -1,5 +1,6 @@
package org.opendaylight.yang.gen.v1.urn.honeycomb.params.xml.ns.yang.v3po2vpp.rev160406;
+import com.google.common.collect.Sets;
import io.fd.honeycomb.v3po.translate.impl.write.GenericListWriter;
import io.fd.honeycomb.v3po.translate.v3po.util.NamingContext;
import io.fd.honeycomb.v3po.translate.v3po.vpp.BridgeDomainCustomizer;
@@ -69,11 +70,14 @@ public class VppHoneycombWriterModule extends
InstanceIdentifier.create(Vpp.class).child(BridgeDomains.class).child(BridgeDomain.class);
registry.addWriter(new GenericListWriter<>(bdId, new BridgeDomainCustomizer(jvpp, bdContext)));
// L2FibTable has no handlers
- // L2FibEntry(handled after BridgeDomain) =
+ // L2FibEntry(handled after BridgeDomain and L2 of ifc and subifc) =
final InstanceIdentifier<L2FibEntry> l2FibEntryId = bdId.child(L2FibTable.class).child(L2FibEntry.class);
registry.addWriterAfter(
new GenericListWriter<>(l2FibEntryId, new L2FibEntryCustomizer(jvpp, bdContext, ifcContext)),
- bdId);
+ Sets.newHashSet(
+ bdId,
+ InterfacesHoneycombWriterModule.L2_ID,
+ SubinterfaceAugmentationWriterFactory.L2_ID));
}
}
}