Bug 7999 Adding Logical_Router table support 24/53324/10
authorTomer Pearl <tomer.pearl@hpe.com>
Wed, 15 Mar 2017 10:07:02 +0000 (12:07 +0200)
committerAnil Vishnoi <vishnoianil@gmail.com>
Fri, 19 May 2017 08:38:21 +0000 (08:38 +0000)
This patch adding support for using the Logical_Router table
in HWVTEP schema.

This addes data flow in (Config-Datastore -> Device) path and
(Device -> Operational-Datastore) path.

Change-Id: I3589f9b7076209c6168e698671cee8186501d3e9
Signed-off-by: Tomer Pearl <tomer.pearl@hpe.com>
hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/HwvtepSouthboundConstants.java
hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/HwvtepSouthboundMapper.java
hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/HwvtepOperationalState.java
hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/LogicalRouterRemoveCommand.java [new file with mode: 0644]
hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/LogicalRouterUpdateCommand.java [new file with mode: 0644]
hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/TransactCommandAggregator.java
hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/TransactUtils.java
hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transactions/md/HwvtepLogicalRouterRemoveCommand.java [new file with mode: 0644]
hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transactions/md/HwvtepLogicalRouterUpdateCommand.java [new file with mode: 0644]
hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transactions/md/HwvtepOperationalCommandAggregator.java
schemas/hardwarevtep/src/main/java/org/opendaylight/ovsdb/schema/hardwarevtep/LogicalRouter.java

index d23226ffdc72402d758d7aca20ad791ca5e92e19..0198493d90e2f9dee3a061046889fbb7d866dee5 100644 (file)
@@ -35,6 +35,8 @@ public class HwvtepSouthboundConstants {
     public static final String HWVTEP_URI_PREFIX = "hwvtep";
     public static final String PSWITCH_URI_PREFIX = "physicalswitch";
     public static final String LOGICALSWITCH_UUID_PREFIX = "LogicalSwitch_";
+    public static final String LOGICALROUTER_UUID_PREFIX = "LogicalRouter_";
+    public static final String ACL_UUID_PREFIX = "Acl_";
     public static final ImmutableMap<String,String> SKIP_HWVTEP_TABLE
             = new ImmutableMap.Builder<String,String>()
             .put("Logical_Binding_Stats", "Update callback registration for Logical_Binding_Stats Table is skipped")
index 2aaa5253078505a3b30781c2d26a793607ae2e52..002671fe7e5885e27167f277d405cb15c961832c 100644 (file)
@@ -14,6 +14,7 @@ import java.net.InetAddress;
 import java.net.UnknownHostException;
 
 import org.opendaylight.ovsdb.lib.OvsdbClient;
+import org.opendaylight.ovsdb.schema.hardwarevtep.ACL;
 import org.opendaylight.ovsdb.schema.hardwarevtep.Global;
 import org.opendaylight.ovsdb.schema.hardwarevtep.LogicalSwitch;
 import org.opendaylight.ovsdb.schema.hardwarevtep.PhysicalLocator;
@@ -23,6 +24,8 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Uri;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.Acls;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.AclsKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.ConnectionInfo;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.LogicalSwitches;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.LogicalSwitchesKey;
@@ -181,6 +184,15 @@ public class HwvtepSouthboundMapper {
         return iid;
     }
 
+    public static InstanceIdentifier<Acls> createInstanceIdentifier(final HwvtepConnectionInstance client,
+            final ACL acl) {
+        return InstanceIdentifier.builder(NetworkTopology.class)
+                .child(Topology.class, new TopologyKey(HwvtepSouthboundConstants.HWVTEP_TOPOLOGY_ID))
+                .child(Node.class, client.getNodeKey()).augmentation(HwvtepGlobalAugmentation.class)
+                .child(Acls.class, new AclsKey(acl.getAclName()))
+                .build();
+    }
+
     public static InstanceIdentifier<Tunnels> createInstanceIdentifier( InstanceIdentifier<Node> nodeIid,
                     InstanceIdentifier<TerminationPoint> localTpIid, InstanceIdentifier<TerminationPoint> remoteTpIid) {
 
index d7c2262797476655b9cc06d9782938a55b765f6a..3a89c516ee4fe245b5b76e630e1d965eef0f4b22 100644 (file)
@@ -25,10 +25,14 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hw
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepPhysicalLocatorAugmentation;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepPhysicalPortAugmentation;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.PhysicalSwitchAugmentation;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.Acls;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.AclsKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.LocalMcastMacs;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.LocalMcastMacsKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.LocalUcastMacs;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.LocalUcastMacsKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.LogicalRouters;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.LogicalRoutersKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.LogicalSwitches;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.LogicalSwitchesKey;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.RemoteMcastMacs;
@@ -331,6 +335,23 @@ public class HwvtepOperationalState {
         return Optional.absent();
     }
 
+    public Optional<LogicalRouters> getLogicalRouters(final InstanceIdentifier<?> iid,
+            final LogicalRoutersKey logicalRoutersKey) {
+        Preconditions.checkNotNull(iid);
+        Optional<HwvtepGlobalAugmentation> nodeOptional = getHwvtepGlobalAugmentation(iid);
+        if (nodeOptional.isPresent()) {
+            HwvtepGlobalAugmentation hgAugmentation = nodeOptional.get();
+            if (hgAugmentation != null && hgAugmentation.getLogicalRouters() != null) {
+                for (LogicalRouters lrouter: hgAugmentation.getLogicalRouters()) {
+                    if (lrouter.getKey().equals(logicalRoutersKey)) {
+                        return Optional.fromNullable(lrouter);
+                    }
+                }
+            }
+        }
+        return Optional.absent();
+    }
+
     public Optional<HwvtepPhysicalLocatorAugmentation> getPhysicalLocatorAugmentation(InstanceIdentifier<TerminationPoint> iid) {
         Optional<TerminationPoint> tp = HwvtepSouthboundUtil.readNode(transaction, iid);
         if (tp.isPresent()) {
@@ -349,6 +370,11 @@ public class HwvtepOperationalState {
         return tunnels;
     }
 
+    public Optional<Acls> getAcls(InstanceIdentifier<Acls> iid) {
+        Optional<Acls> acl = HwvtepSouthboundUtil.readNode(transaction, iid);
+        return acl;
+    }
+
     public ReadWriteTransaction getReadWriteTransaction() {
         return transaction;
     }
diff --git a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/LogicalRouterRemoveCommand.java b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/LogicalRouterRemoveCommand.java
new file mode 100644 (file)
index 0000000..b4a7857
--- /dev/null
@@ -0,0 +1,104 @@
+/*
+ * Copyright © 2017 Hewlett Packard Enterprise, Co. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.ovsdb.hwvtepsouthbound.transact;
+
+import static org.opendaylight.ovsdb.lib.operations.Operations.op;
+
+import com.google.common.base.Optional;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import org.opendaylight.controller.md.sal.binding.api.DataTreeModification;
+import org.opendaylight.ovsdb.hwvtepsouthbound.HwvtepSouthboundUtil;
+import org.opendaylight.ovsdb.lib.notation.UUID;
+import org.opendaylight.ovsdb.lib.operations.TransactionBuilder;
+import org.opendaylight.ovsdb.lib.schema.typed.TyperUtils;
+import org.opendaylight.ovsdb.schema.hardwarevtep.LogicalRouter;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepGlobalAugmentation;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.LogicalRouters;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
+import org.opendaylight.yangtools.yang.binding.Identifiable;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class LogicalRouterRemoveCommand extends AbstractTransactCommand<LogicalRouters, HwvtepGlobalAugmentation> {
+    private static final Logger LOG = LoggerFactory.getLogger(LogicalRouterRemoveCommand.class);
+
+    public LogicalRouterRemoveCommand(HwvtepOperationalState state,
+            Collection<DataTreeModification<Node>> changes) {
+        super(state, changes);
+    }
+
+    @Override
+    public void execute(TransactionBuilder transaction) {
+        Map<InstanceIdentifier<Node>, List<LogicalRouters>> removed =
+              extractRemoved(getChanges(),LogicalRouters.class);
+      if (removed != null) {
+          for (Entry<InstanceIdentifier<Node>, List<LogicalRouters>> created: removed.entrySet()) {
+              if (!HwvtepSouthboundUtil.isEmpty(created.getValue())) {
+                  for (LogicalRouters lRouter : created.getValue()) {
+                      InstanceIdentifier<LogicalRouters> lsKey = created.getKey().augmentation(
+                              HwvtepGlobalAugmentation.class).child(LogicalRouters.class, lRouter.getKey());
+                      updateCurrentTxDeleteData(LogicalRouters.class, lsKey, lRouter);
+                  }
+                  getOperationalState().getDeviceInfo().scheduleTransaction(new TransactCommand() {
+                      @Override
+                      public void execute(TransactionBuilder transactionBuilder) {
+                          LOG.debug("Running delete logical router in seperate tx {}", created.getKey());
+                          removeLogicalRouter(transactionBuilder, created.getKey(), created.getValue());
+                      }
+
+                      @Override
+                      public void onConfigUpdate(TransactionBuilder transaction, InstanceIdentifier nodeIid,
+                                                 Identifiable data, InstanceIdentifier key, Object... extraData) {
+                      }
+
+                      @Override
+                      public void doDeviceTransaction(TransactionBuilder transaction, InstanceIdentifier nodeIid,
+                                                      Identifiable data, InstanceIdentifier key, Object... extraData) {
+                      }
+                  });
+              }
+          }
+      }
+    }
+
+      private void removeLogicalRouter(TransactionBuilder transaction,
+              final InstanceIdentifier<Node> instanceIdentifier, final List<LogicalRouters> lRouterList) {
+          for (LogicalRouters lrouter: lRouterList) {
+              LOG.debug("Removing logical router named: {}", lrouter.getHwvtepNodeName().getValue());
+              Optional<LogicalRouters> operationalRouterOptional =
+                      getOperationalState().getLogicalRouters(instanceIdentifier, lrouter.getKey());
+
+              if (operationalRouterOptional.isPresent() &&
+                      operationalRouterOptional.get().getLogicalRouterUuid() != null) {
+                  LogicalRouter logicalRouter = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(), LogicalRouter.class, null);
+                  UUID logicalRouterUuid = new UUID(operationalRouterOptional.get().getLogicalRouterUuid().getValue());
+                  transaction.add(op.delete(logicalRouter.getSchema())
+                          .where(logicalRouter.getUuidColumn().getSchema().opEqual(logicalRouterUuid)).build());
+                  transaction.add(op.comment("Logical Router: Deleting " + lrouter.getHwvtepNodeName().getValue()));
+              } else {
+                  LOG.warn("Unable to delete logical router {} because it was not found in the operational data store",
+                          lrouter.getHwvtepNodeName().getValue());
+              }
+          }
+      }
+
+      @Override
+      protected List<LogicalRouters> getData(final HwvtepGlobalAugmentation augmentation) {
+          return augmentation.getLogicalRouters();
+      }
+
+      @Override
+      protected boolean areEqual(final LogicalRouters a , final LogicalRouters b) {
+          return a.getKey().equals(b.getKey());
+      }
+}
\ No newline at end of file
diff --git a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/LogicalRouterUpdateCommand.java b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transact/LogicalRouterUpdateCommand.java
new file mode 100644 (file)
index 0000000..5d56cbf
--- /dev/null
@@ -0,0 +1,169 @@
+/*
+ * Copyright © 2017 Hewlett Packard Enterprise, Co. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.ovsdb.hwvtepsouthbound.transact;
+
+import static org.opendaylight.ovsdb.lib.operations.Operations.op;
+
+import com.google.common.base.Optional;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import org.opendaylight.controller.md.sal.binding.api.DataTreeModification;
+import org.opendaylight.ovsdb.lib.notation.UUID;
+import org.opendaylight.ovsdb.lib.operations.TransactionBuilder;
+import org.opendaylight.ovsdb.lib.schema.typed.TyperUtils;
+import org.opendaylight.ovsdb.schema.hardwarevtep.LogicalRouter;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepGlobalAugmentation;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.Acls;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.LogicalRouters;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.LogicalSwitches;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.logical.router.attributes.AclBindings;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.logical.router.attributes.StaticRoutes;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.logical.router.attributes.SwitchBindings;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+public class LogicalRouterUpdateCommand extends AbstractTransactCommand<LogicalRouters, HwvtepGlobalAugmentation> {
+    private static final Logger LOG = LoggerFactory.getLogger(LogicalRouterUpdateCommand.class);
+
+    public LogicalRouterUpdateCommand(HwvtepOperationalState state,
+            Collection<DataTreeModification<Node>> changes) {
+        super(state, changes);
+    }
+    @Override
+    public void execute(TransactionBuilder transaction) {
+        Map<InstanceIdentifier<Node>, List<LogicalRouters>> updates =
+                extractUpdated(getChanges(),LogicalRouters.class);
+        if (updates != null) {
+            for (Entry<InstanceIdentifier<Node>, List<LogicalRouters>> updated:
+                updates.entrySet()) {
+                updateLogicalRouter(transaction,  updated.getKey(), updated.getValue());
+            }
+        }
+    }
+
+    private void updateLogicalRouter(TransactionBuilder transaction, final InstanceIdentifier<Node> instanceIdentifier,
+            final List<LogicalRouters> lRouterList) {
+        for (LogicalRouters lrouter: lRouterList) {
+            InstanceIdentifier<LogicalRouters> lRouterKey = instanceIdentifier.
+                    augmentation(HwvtepGlobalAugmentation.class).child(LogicalRouters.class, lrouter.getKey());
+            LOG.debug("Creating logical router named: {}", lrouter.getHwvtepNodeName());
+
+            Optional<LogicalRouters> operationalRouterOptional =
+                    getOperationalState().getLogicalRouters(instanceIdentifier, lrouter.getKey());
+            LogicalRouter logicalRouter = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(), LogicalRouter.class);
+            setDescription(logicalRouter, lrouter);
+
+            setSwitchBindings(logicalRouter, lrouter.getSwitchBindings());
+            setStaticRoutes(logicalRouter, lrouter.getStaticRoutes());
+            setAclBindings(logicalRouter, lrouter.getAclBindings());
+
+            if (!operationalRouterOptional.isPresent()) {
+                setName(logicalRouter, lrouter, operationalRouterOptional);
+                LOG.trace("Creating LogicalRouter entry: {}", logicalRouter);
+                transaction.add(op.insert(logicalRouter).withId(TransactUtils.getLogicalRouterId(lrouter)));
+                transaction.add(op.comment("Logical Router: Creating " + lrouter.getHwvtepNodeName().getValue()));
+                UUID lrUuid = new UUID(TransactUtils.getLogicalRouterId(lrouter));
+                updateCurrentTxData(LogicalRouters.class, lRouterKey, lrUuid, lrouter);
+            } else {
+                LogicalRouters updatedLRouter = operationalRouterOptional.get();
+                String existingLogicalRouterName = updatedLRouter.getHwvtepNodeName().getValue();
+                LogicalRouter extraLogicalRouter = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(), LogicalRouter.class);
+                extraLogicalRouter.setName("");
+                LOG.trace("Updating LogicalRouter entry: {}", logicalRouter);
+                transaction.add(op.update(logicalRouter)
+                        .where(extraLogicalRouter.getNameColumn().getSchema().opEqual(existingLogicalRouterName))
+                        .build());
+                transaction.add(op.comment("Logical Router: Updating " + existingLogicalRouterName));
+            }
+        }
+
+    }
+
+    private void setDescription(final LogicalRouter logicalRouter, final LogicalRouters inputRouter) {
+        if(inputRouter.getHwvtepNodeDescription() != null) {
+            logicalRouter.setDescription(inputRouter.getHwvtepNodeDescription());
+        } else {
+            LOG.warn("Logical router {} is missing a description string", inputRouter.getHwvtepNodeName());
+        }
+    }
+    private void setName(final LogicalRouter logicalRouter, final LogicalRouters inputRouter,
+            Optional<LogicalRouters> inputRouterOptional) {
+        if (inputRouter.getHwvtepNodeName() != null) {
+            logicalRouter.setName(inputRouter.getHwvtepNodeName().getValue());
+        } else if (inputRouterOptional.isPresent() && inputRouterOptional.get().getHwvtepNodeName() != null) {
+            logicalRouter.setName(inputRouterOptional.get().getHwvtepNodeName().getValue());
+        }
+    }
+
+    private void setSwitchBindings(final LogicalRouter logicalRouter, final List<SwitchBindings> switchBindings) {
+        if (switchBindings != null) {
+            Map<String, UUID> bindingMap = new HashMap<String, UUID>();
+            for (SwitchBindings switchBinding : switchBindings) {
+                @SuppressWarnings("unchecked")
+                InstanceIdentifier<LogicalSwitches> lswitchIid =
+                        (InstanceIdentifier<LogicalSwitches>)switchBinding.getLogicalSwitchRef().getValue();
+                Optional<LogicalSwitches> operationalSwitchOptional =
+                        getOperationalState().getLogicalSwitches(lswitchIid);
+                if (operationalSwitchOptional.isPresent()) {
+                    Uuid logicalSwitchUuid = operationalSwitchOptional.get().getLogicalSwitchUuid();
+                    bindingMap.put(switchBinding.getDestinationAddress().getIpv4Prefix().getValue(),
+                            new UUID(logicalSwitchUuid.getValue()));
+                }else{
+                    bindingMap.put(switchBinding.getDestinationAddress().getIpv4Prefix().getValue(),
+                            TransactUtils.getLogicalSwitchUUID(lswitchIid));
+                }
+            }
+            logicalRouter.setSwitchBinding(bindingMap);
+        }
+    }
+
+    private void setAclBindings(final LogicalRouter logicalRouter, final List<AclBindings> aclBindings) {
+        if (aclBindings != null) {
+            Map<String, UUID> bindingMap = new HashMap<String, UUID>();
+            for (AclBindings aclBinding : aclBindings) {
+                @SuppressWarnings("unchecked")
+                InstanceIdentifier<Acls> aclIid =
+                        (InstanceIdentifier<Acls>)aclBinding.getAclRef().getValue();
+                Optional<Acls> operationalAclOptional =
+                        getOperationalState().getAcls(aclIid);
+                if (operationalAclOptional.isPresent()) {
+                    Uuid AclUuid = operationalAclOptional.get().getAclUuid();
+                    bindingMap.put(String.valueOf(aclBinding.getRouterInterface().getValue()), new UUID(AclUuid.getValue()));
+                }else{
+                    bindingMap.put(String.valueOf(aclBinding.getRouterInterface().getValue()), TransactUtils.getAclUUID(aclIid));
+                }
+            }
+            logicalRouter.setAclBinding(bindingMap);
+        }
+
+    }
+    private void setStaticRoutes(final LogicalRouter logicalRouter, final List<StaticRoutes> staticRoutes) {
+        if (staticRoutes != null) {
+            Map<String, String> staticRoutesMap = new HashMap<String, String>();
+            for (StaticRoutes staticRoute : staticRoutes) {
+                staticRoutesMap.put(String.valueOf(staticRoute.getDestinationAddress().getValue()),
+                        String.valueOf(staticRoute.getNexthopAddress().getValue()));
+            }
+            logicalRouter.setStaticRoutes(staticRoutesMap);
+        }
+    }
+
+    @Override
+    protected List<LogicalRouters> getData(final HwvtepGlobalAugmentation augmentation) {
+        return augmentation.getLogicalRouters();
+    }
+}
+
index 00fcc3e28277ec1da337b04edb77630d62988058..7f6c937e3d894fce33bb5c5f3c7112db0193ae11 100644 (file)
@@ -63,6 +63,8 @@ public class TransactCommandAggregator implements TransactCommand {
         commands.add(new UcastMacsLocalRemoveCommand(state,changes));
         commands.add(new TunnelUpdateCommand(state,changes));
         commands.add(new TunnelRemoveCommand(state,changes));
+        commands.add(new LogicalRouterUpdateCommand(state,changes));
+        commands.add(new LogicalRouterRemoveCommand(state,changes));
     }
 
     @Override
index bae6f08108a9ac4f25e9f5792217094f03159801..903aae29940e5f4dd5fd97a3deb3c69a301206bd 100644 (file)
@@ -35,7 +35,9 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hw
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepPhysicalLocatorAugmentation;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepPhysicalLocatorAugmentationBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.physical.locator.set.attributes.LocatorSet;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.LogicalRouters;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.LogicalSwitches;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.Acls;
 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
@@ -211,8 +213,12 @@ public class TransactUtils {
     }
 
     static String sanitizeUUID(HwvtepNodeName hwvtepNodeName) {
+        return sanitizeUUID(hwvtepNodeName.getValue());
+    }
+
+    static String sanitizeUUID(String nodeName) {
         //ovs is not accepting '-' in the named uuids
-        return hwvtepNodeName.getValue().replaceAll("-", "_");
+        return nodeName.replaceAll("-", "_");
     }
 
     public static String getLogicalSwitchId(LogicalSwitches lswitch){
@@ -223,4 +229,13 @@ public class TransactUtils {
         return new UUID(HwvtepSouthboundConstants.LOGICALSWITCH_UUID_PREFIX +
                 sanitizeUUID(lswitchIid.firstKeyOf(LogicalSwitches.class).getHwvtepNodeName()));
     }
+
+    public static String getLogicalRouterId(final LogicalRouters lrouter){
+        return HwvtepSouthboundConstants.LOGICALROUTER_UUID_PREFIX + sanitizeUUID(lrouter.getHwvtepNodeName());
+    }
+
+    public static UUID getAclUUID(final InstanceIdentifier<Acls> aclIid){
+        return new UUID(HwvtepSouthboundConstants.ACL_UUID_PREFIX +
+                sanitizeUUID(aclIid.firstKeyOf(Acls.class).getAclName()));
+    }
 }
diff --git a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transactions/md/HwvtepLogicalRouterRemoveCommand.java b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transactions/md/HwvtepLogicalRouterRemoveCommand.java
new file mode 100644 (file)
index 0000000..b9c1861
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * Copyright © 2017 Hewlett Packard Enterprise, Co. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.ovsdb.hwvtepsouthbound.transactions.md;
+
+import java.util.Collection;
+import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction;
+import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.ovsdb.hwvtepsouthbound.HwvtepConnectionInstance;
+import org.opendaylight.ovsdb.lib.message.TableUpdates;
+import org.opendaylight.ovsdb.lib.schema.DatabaseSchema;
+import org.opendaylight.ovsdb.lib.schema.typed.TyperUtils;
+import org.opendaylight.ovsdb.schema.hardwarevtep.LogicalRouter;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepGlobalAugmentation;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepNodeName;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.LogicalRouters;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.LogicalRoutersKey;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class HwvtepLogicalRouterRemoveCommand extends AbstractTransactionCommand<LogicalRouters> {
+    private static final Logger LOG = LoggerFactory.getLogger(HwvtepLogicalRouterRemoveCommand.class);
+
+    public HwvtepLogicalRouterRemoveCommand(HwvtepConnectionInstance key, TableUpdates updates, DatabaseSchema dbSchema) {
+        super(key, updates, dbSchema);
+    }
+
+    @Override
+    public void execute(ReadWriteTransaction transaction) {
+        Collection<LogicalRouter> deletedLRRows =
+                TyperUtils.extractRowsRemoved(LogicalRouter.class, getUpdates(), getDbSchema()).values();
+        if (deletedLRRows != null) {
+            for (LogicalRouter lRouter : deletedLRRows) {
+                HwvtepNodeName routerNode = new HwvtepNodeName(lRouter.getName());
+                LOG.debug("Clearing device operational data for logical router {}", routerNode);
+                InstanceIdentifier<LogicalRouters> routerIid = getOvsdbConnectionInstance().getInstanceIdentifier()
+                        .augmentation(HwvtepGlobalAugmentation.class)
+                        .child(LogicalRouters.class, new LogicalRoutersKey(routerNode));
+                transaction.delete(LogicalDatastoreType.OPERATIONAL, routerIid);
+                getOvsdbConnectionInstance().getDeviceInfo().clearDeviceOperData(LogicalRouters.class, routerIid);
+            }
+        }
+    }
+
+}
diff --git a/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transactions/md/HwvtepLogicalRouterUpdateCommand.java b/hwvtepsouthbound/hwvtepsouthbound-impl/src/main/java/org/opendaylight/ovsdb/hwvtepsouthbound/transactions/md/HwvtepLogicalRouterUpdateCommand.java
new file mode 100644 (file)
index 0000000..8e1b229
--- /dev/null
@@ -0,0 +1,175 @@
+/*
+ * Copyright © 2017 Hewlett Packard Enterprise, Co. and others. All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
+package org.opendaylight.ovsdb.hwvtepsouthbound.transactions.md;
+
+import com.google.common.base.Optional;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction;
+import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.ovsdb.hwvtepsouthbound.HwvtepConnectionInstance;
+import org.opendaylight.ovsdb.hwvtepsouthbound.HwvtepSouthboundMapper;
+import org.opendaylight.ovsdb.hwvtepsouthbound.HwvtepSouthboundUtil;
+import org.opendaylight.ovsdb.lib.message.TableUpdates;
+import org.opendaylight.ovsdb.lib.notation.UUID;
+import org.opendaylight.ovsdb.lib.schema.DatabaseSchema;
+import org.opendaylight.ovsdb.lib.schema.typed.TyperUtils;
+import org.opendaylight.ovsdb.schema.hardwarevtep.ACL;
+import org.opendaylight.ovsdb.schema.hardwarevtep.LogicalRouter;
+import org.opendaylight.ovsdb.schema.hardwarevtep.LogicalSwitch;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepAclRef;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepGlobalAugmentation;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepGlobalAugmentationBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepLogicalSwitchRef;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepNodeName;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.Acls;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.LogicalRouters;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.LogicalRoutersBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.LogicalRoutersKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.global.attributes.LogicalSwitches;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.logical.router.attributes.AclBindings;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.logical.router.attributes.AclBindingsBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.logical.router.attributes.StaticRoutes;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.logical.router.attributes.StaticRoutesBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.logical.router.attributes.SwitchBindings;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.hwvtep.logical.router.attributes.SwitchBindingsBuilder;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeBuilder;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+public class HwvtepLogicalRouterUpdateCommand extends AbstractTransactionCommand {
+    private static final Logger LOG = LoggerFactory.getLogger(HwvtepLogicalRouterUpdateCommand.class);
+    private Map<UUID, LogicalRouter> updatedLRRows;
+
+    public HwvtepLogicalRouterUpdateCommand(HwvtepConnectionInstance key, TableUpdates updates, DatabaseSchema dbSchema) {
+        super(key, updates, dbSchema);
+        updatedLRRows = TyperUtils.extractRowsUpdated(LogicalRouter.class, getUpdates(), getDbSchema());
+    }
+
+    @Override
+    public void execute(ReadWriteTransaction transaction) {
+        for (Entry<UUID, LogicalRouter> entry : updatedLRRows.entrySet()) {
+            LOG.trace("Updating logical router {} with {}", entry.getKey(), entry.getValue());
+            updateLogicalRouter(transaction, entry.getValue());
+        }
+    }
+
+    private void updateLogicalRouter(ReadWriteTransaction transaction, final LogicalRouter lRouter) {
+        final InstanceIdentifier<Node> connectionIId = getOvsdbConnectionInstance().getInstanceIdentifier();
+        Optional<Node> connection = HwvtepSouthboundUtil.readNode(transaction, connectionIId);
+        if (connection.isPresent()) {
+            Node connectionNode = buildConnectionNode(lRouter);
+            transaction.merge(LogicalDatastoreType.OPERATIONAL, connectionIId, connectionNode);
+            InstanceIdentifier<LogicalRouters> routerIid = getOvsdbConnectionInstance().getInstanceIdentifier()
+                    .augmentation(HwvtepGlobalAugmentation.class)
+                    .child(LogicalRouters.class, new LogicalRoutersKey(new HwvtepNodeName(lRouter.getName())));
+            getOvsdbConnectionInstance().getDeviceInfo().updateDeviceOperData(LogicalRouters.class, routerIid,
+                    lRouter.getUuid(), lRouter);
+        }
+    }
+
+    private Node buildConnectionNode(final LogicalRouter lRouter) {
+        //Update node with LogicalRouter reference
+        NodeBuilder connectionNode = new NodeBuilder();
+        connectionNode.setNodeId(getOvsdbConnectionInstance().getNodeId());
+        HwvtepGlobalAugmentationBuilder hgAugmentationBuilder = new HwvtepGlobalAugmentationBuilder();
+        List<LogicalRouters> lRouters = new ArrayList<>();
+        LogicalRoutersBuilder lrBuilder = new LogicalRoutersBuilder();
+        lrBuilder.setLogicalRouterUuid(new Uuid(lRouter.getUuid().toString()));
+        lrBuilder.setHwvtepNodeDescription(lRouter.getDescription());
+        HwvtepNodeName hwvtepName = new HwvtepNodeName(lRouter.getName());
+        lrBuilder.setHwvtepNodeName(hwvtepName);
+        lrBuilder.setKey(new LogicalRoutersKey(hwvtepName));
+
+        setSwitchBindings(lRouter, lrBuilder);
+        setStaticRoutes(lRouter, lrBuilder);
+        setAclBindings(lRouter, lrBuilder);
+
+        lRouters.add(lrBuilder.build());
+        hgAugmentationBuilder.setLogicalRouters(lRouters);
+        connectionNode.addAugmentation(HwvtepGlobalAugmentation.class, hgAugmentationBuilder.build());
+        return connectionNode.build();
+    }
+
+    private void setStaticRoutes(final LogicalRouter lRouter, final LogicalRoutersBuilder lrBuilder) {
+        if (isRouterHasStaticRoutes(lRouter)) {
+            List<StaticRoutes> routes = new ArrayList<>();
+            for (Entry<String, String> entry : lRouter.getStaticRoutesColumn().getData().entrySet()) {
+                StaticRoutesBuilder staticRouteBuilder = new StaticRoutesBuilder();
+                staticRouteBuilder.setDestinationAddress(new IpPrefix(new Ipv4Prefix(entry.getKey())));
+                staticRouteBuilder.setNexthopAddress(new IpAddress(new Ipv4Address(entry.getKey())));
+                routes.add(staticRouteBuilder.build());
+            }
+            lrBuilder.setStaticRoutes(routes);
+        }
+    }
+
+    private boolean isRouterHasStaticRoutes(final LogicalRouter lRouter) {
+        return lRouter != null && lRouter.getStaticRoutesColumn() != null && lRouter.getStaticRoutesColumn().getData() != null
+                && !lRouter.getStaticRoutesColumn().getData().isEmpty();
+    }
+
+    private void setAclBindings(final LogicalRouter lRouter, final LogicalRoutersBuilder lrBuilder) {
+        if (isRouterHasAcls(lRouter)) {
+            List<AclBindings> bindings = new ArrayList<>();
+            for (Entry<String, UUID> entry : lRouter.getAclBindingColumn().getData().entrySet()) {
+                AclBindingsBuilder aclBindingBuiler = new AclBindingsBuilder();
+                UUID aclUUID = entry.getValue();
+                ACL acl = (ACL)getOvsdbConnectionInstance().getDeviceInfo().getDeviceOperData(Acls.class, aclUUID);
+                if (acl != null) {
+                    InstanceIdentifier<Acls> aclIid =
+                            HwvtepSouthboundMapper.createInstanceIdentifier(getOvsdbConnectionInstance(), acl);
+                    aclBindingBuiler.setAclRef(new HwvtepAclRef(aclIid));
+                    aclBindingBuiler.setRouterInterface(new IpPrefix(new Ipv4Prefix(entry.getKey())));
+                    bindings.add(aclBindingBuiler.build());
+                }
+                lrBuilder.setAclBindings(bindings);
+            }
+        }
+    }
+
+    private boolean isRouterHasAcls(final LogicalRouter lRouter) {
+        return lRouter != null && lRouter.getAclBindingColumn() != null && lRouter.getAclBindingColumn().getData() != null
+                && !lRouter.getAclBindingColumn().getData().isEmpty();
+    }
+
+    private void setSwitchBindings(final LogicalRouter lRouter, final LogicalRoutersBuilder lrBuilder) {
+        if (isRouterHasSwitchBindings(lRouter)) {
+            List<SwitchBindings> bindings = new ArrayList<>();
+            for (Entry<String, UUID> entry : lRouter.getSwitchBindingColumn().getData().entrySet()) {
+                SwitchBindingsBuilder switchBindingBuiler = new SwitchBindingsBuilder();
+                UUID lsUUID = entry.getValue();
+                LogicalSwitch logicalSwitch = getOvsdbConnectionInstance().getDeviceInfo().getLogicalSwitch(lsUUID);
+                if (logicalSwitch != null) {
+                    switchBindingBuiler.setDestinationAddress(new IpPrefix(new Ipv4Prefix(entry.getKey())));
+                    InstanceIdentifier<LogicalSwitches> lSwitchIid =
+                            HwvtepSouthboundMapper.createInstanceIdentifier(getOvsdbConnectionInstance(), logicalSwitch);
+                    switchBindingBuiler.setLogicalSwitchRef(new HwvtepLogicalSwitchRef(lSwitchIid));
+                    bindings.add(switchBindingBuiler.build());
+                }
+            }
+            lrBuilder.setSwitchBindings(bindings);
+        }
+    }
+
+    private boolean isRouterHasSwitchBindings(final LogicalRouter lRouter) {
+        return lRouter != null && lRouter.getSwitchBindingColumn() != null && lRouter.getSwitchBindingColumn().getData() != null
+                && !lRouter.getSwitchBindingColumn().getData().isEmpty();
+    }
+}
index c740850211d5c0307584aa827d26858607e11dd8..50ea4d2c6fcd2aeaa65d23fd22d6a6f021048778 100644 (file)
@@ -46,6 +46,8 @@ public class HwvtepOperationalCommandAggregator implements TransactionCommand {
         commands.add(new HwvtepMcastMacsRemoteUpdateCommand(key, updates, dbSchema));
         commands.add(new HwvtepMacEntriesRemoveCommand(key, updates, dbSchema));
         commands.add(new HwvtepLogicalSwitchRemoveCommand(key, updates, dbSchema));
+        commands.add(new HwvtepLogicalRouterUpdateCommand(key, updates, dbSchema));
+        commands.add(new HwvtepLogicalRouterRemoveCommand(key, updates, dbSchema));
     }
 
     @Override
index 7bfa9054a8e22fdfd1d6a72f99ede1db393a5cec..a5a18ec8e6acad74a8a1b575592832d2819740e5 100644 (file)
@@ -48,7 +48,7 @@ public interface LogicalRouter extends TypedBaseTable<GenericTableSchema> {
 
 
     @TypedColumn(name="static_routes", method=MethodType.GETCOLUMN, fromVersion="1.0.0")
-    Column<GenericTableSchema, Map<String, String>> setStaticRoutesColumn();
+    Column<GenericTableSchema, Map<String, String>> getStaticRoutesColumn();
 
     @TypedColumn(name="static_routes", method=MethodType.SETDATA, fromVersion="1.0.0")
     void setStaticRoutes(Map<String, String> staticRoutes);