Add implementation for flat L3 overlay
[groupbasedpolicy.git] / renderers / vpp / src / main / java / org / opendaylight / groupbasedpolicy / renderer / vpp / commands / AbstractInterfaceCommand.java
index 9bf717d5c38796f57370e764ccadd579a5dd8ad1..8b921d64612968e64bc0353b4f7f9c82785ce25c 100644 (file)
@@ -10,25 +10,30 @@ package org.opendaylight.groupbasedpolicy.renderer.vpp.commands;
 
 import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
+import org.opendaylight.groupbasedpolicy.renderer.vpp.commands.interfaces.ConfigCommand;
+import org.opendaylight.groupbasedpolicy.renderer.vpp.commands.interfaces.InterfaceCommand;
 import org.opendaylight.groupbasedpolicy.renderer.vpp.util.General;
 import org.opendaylight.groupbasedpolicy.renderer.vpp.util.VppIidFactory;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceBuilder;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.proxy.arp.rev170315.ProxyArpInterfaceAugmentation;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.proxy.arp.rev170315.ProxyArpInterfaceAugmentationBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.proxy.arp.rev170315.interfaces._interface.ProxyArpBuilder;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public abstract class AbstractInterfaceCommand<T extends AbstractInterfaceCommand<T>> implements ConfigCommand {
+public abstract class AbstractInterfaceCommand implements ConfigCommand, InterfaceCommand {
 
     private static final Logger LOG = LoggerFactory.getLogger(AbstractInterfaceCommand.class);
 
     protected General.Operations operation;
     protected String name;
     protected String description;
+    protected String bridgeDomain;
     protected Boolean enabled;
-
-    protected enum linkUpDownTrap {
-        ENABLED, DISABLED
-    }
+    protected Boolean enableProxyArp;
+    protected Long vrfId;
 
     public General.Operations getOperation() {
         return operation;
@@ -38,22 +43,21 @@ public abstract class AbstractInterfaceCommand<T extends AbstractInterfaceComman
         return name;
     }
 
+    public Long getVrfId() {
+        return vrfId;
+    }
+
     public String getDescription() {
         return description;
     }
 
-    public AbstractInterfaceCommand<T> setDescription(String description) {
+    public AbstractInterfaceCommand setDescription(String description) {
         this.description = description;
         return this;
     }
 
-    public Boolean getEnabled() {
-        return enabled;
-    }
-
-    public AbstractInterfaceCommand<T> setEnabled(Boolean enabled) {
-        this.enabled = enabled;
-        return this;
+    public String getBridgeDomain() {
+        return bridgeDomain;
     }
 
     public void execute(ReadWriteTransaction rwTx) {
@@ -99,4 +103,16 @@ public abstract class AbstractInterfaceCommand<T extends AbstractInterfaceComman
         }
 
     }
+    @Override public InstanceIdentifier getIid() {
+        return VppIidFactory.getInterfaceIID(this.getInterfaceBuilder().getKey());
+    }
+
+    protected void addEnableProxyArpAugmentation(InterfaceBuilder interfaceBuilder) {
+        if (enableProxyArp != null) {
+            ProxyArpInterfaceAugmentationBuilder augmentationBuilder = new ProxyArpInterfaceAugmentationBuilder();
+            augmentationBuilder.setProxyArp((new ProxyArpBuilder()).build());
+            interfaceBuilder.addAugmentation(ProxyArpInterfaceAugmentation.class, augmentationBuilder.build());
+        }
+    }
+
 }