Add binding profile attribute to NeutronPort object 15/66915/8
authorEdan David <edandavi@gmail.com>
Sun, 7 Jan 2018 08:15:25 +0000 (03:15 -0500)
committerIsaku Yamahata <isaku.yamahata@gmail.com>
Tue, 16 Jan 2018 20:14:08 +0000 (20:14 +0000)
Binding profile is sent as a json string by networking-odl [1]
[1] https://review.openstack.org/#/c/529303/

Change-Id: Idd3fc6bd4df6daee26b67704697eb71f3a547048
Signed-off-by: Edan David <edandavi@gmail.com>
neutron-spi/src/main/java/org/opendaylight/neutron/spi/NeutronPort.java
neutron-spi/src/test/java/org/opendaylight/neutron/spi/NeutronPortJAXBTest.java
transcriber/src/main/java/org/opendaylight/neutron/transcriber/NeutronPortInterface.java

index 141b41018f1a22cf5392b0a96b2e7e72a899d8d3..f990d371480395ef747ce02f1d207f9f0c7137fa 100644 (file)
@@ -60,6 +60,10 @@ public final class NeutronPort extends NeutronAdminAttributes<NeutronPort> imple
     @XmlElement(namespace = "binding", name = "vif_type")
     String bindingvifType;
 
+    //@XmlElement (name = "binding:profile")
+    @XmlElement(namespace = "binding", name = "profile")
+    String bindingProfile;
+
     //@XmlElement (name = "binding:vif_details")
     @XmlElement(namespace = "binding", name = "vif_details")
     @XmlJavaTypeAdapter(NeutronResourceMapPropertyAdapter.class)
@@ -165,6 +169,14 @@ public final class NeutronPort extends NeutronAdminAttributes<NeutronPort> imple
         this.bindinghostID = bindinghostID;
     }
 
+    public String getProfile() {
+        return bindingProfile;
+    }
+
+    public void setProfile(String newBindingProfile) {
+        this.bindingProfile = newBindingProfile;
+    }
+
     public String getBindingvnicType() {
         return bindingvnicType;
     }
@@ -234,6 +246,9 @@ public final class NeutronPort extends NeutronAdminAttributes<NeutronPort> imple
             case "binding:vif_type":
                 ans.setBindingvifType(this.getBindingvifType());
                 break;
+            case "binding:profile":
+                ans.setProfile(this.getProfile());
+                break;
             case "binding:vif_details":
                 ans.setVIFDetails(new HashMap<>(this.getVIFDetails()));
                 break;
@@ -270,7 +285,8 @@ public final class NeutronPort extends NeutronAdminAttributes<NeutronPort> imple
                 + ", deviceID=" + deviceID + ", deviceOwner=" + deviceOwner + ", tenantID=" + tenantID
                 + ", securityGroups=" + securityGroups + ", allowedAddressPairs" + allowedAddressPairs
                 + ", bindinghostID=" + bindinghostID + ", bindingvnicType=" + bindingvnicType + ", bindingvifType="
-                + bindingvifType + ", vifDetails=" + vifDetails + ", extraDHCPOptions=" + extraDHCPOptions
+                + bindingvifType + ", vifDetails=" + vifDetails + ", bindingProfile=" + bindingProfile
+                + ", extraDHCPOptions=" + extraDHCPOptions
                 + ", portSecurityEnabled=" + portSecurityEnabled + ", qosPolicyId=" + qosPolicyId + "]";
     }
 }
index 6846daa2527f8501580b9fa2cd2824f6ab60657f..e054b4de75e1171e1c6c2ed43fa5b4ff7292eb84 100644 (file)
@@ -24,8 +24,8 @@ public class NeutronPortJAXBTest {
             + "\"extra_dhcp_opts\": [\"\"], " + "\"security_groups\": [\"\"], " + "\"allowed_address_pairs\": [\"\"], "
             + "\"device_id\": \"257614cc-e178-4c92-9c61-3b28d40eca44\", " + "\"device_owner\": \"\", "
             + "\"binding:host_id\": \"\", " + "\"binding:vif_type\": \"unbound\", "
-            + "\"binding:vnic_type\": \"normal\", " + "\"mac_address\": \"fa:16:3e:c9:cb:f0\", "
-            + "\"network_id\": \"e9330b1f-a2ef-4160-a991-169e56ab17f5\", "
+            + "\"binding:vnic_type\": \"normal\", " + "\"binding:profile\": \"{\'capabilities\': [\'switchdev\']}\", "
+            + "\"mac_address\": \"fa:16:3e:c9:cb:f0\", " + "\"network_id\": \"e9330b1f-a2ef-4160-a991-169e56ab17f5\", "
             + "\"id\": \"4e8e5957-649f-477b-9e5b-f1f75b21c03c\" }";
 
     @Test
@@ -97,7 +97,7 @@ public class NeutronPortJAXBTest {
         Assert.assertEquals("NeutronPort JAXB Test 16: Testing device_owner failed", "",
                 neutronObject.getDeviceOwner());
 
-        Assert.assertEquals("NeutronPort JAXB Test 17: Testing binding:host_id failed", "",
-                neutronObject.getBindinghostID());
+        Assert.assertEquals("NeutronPort JAXB Test 17: Testing binding:profile failed",
+                "{\'capabilities\': [\'switchdev\']}", neutronObject.getProfile());
     }
 }
index 44c7d1807ad6513a7c277969803a002b6a370265..68917c6163b38de83376bcd6507cec5791d47024 100644 (file)
@@ -75,6 +75,7 @@ public final class NeutronPortInterface extends AbstractNeutronInterface<Port, P
             }
             result.setVIFDetails(details);
         }
+        result.setProfile(binding.getProfile());
         result.setBindingvifType(binding.getVifType());
         result.setBindingvnicType(binding.getVnicType());
     }
@@ -176,6 +177,9 @@ public final class NeutronPortInterface extends AbstractNeutronInterface<Port, P
         if (neutronPort.getBindingvnicType() != null) {
             bindingBuilder.setVnicType(neutronPort.getBindingvnicType());
         }
+        if (neutronPort.getProfile() != null) {
+            bindingBuilder.setProfile(neutronPort.getProfile());
+        }
 
         final PortSecurityExtensionBuilder portSecurityBuilder = new PortSecurityExtensionBuilder();
         if (neutronPort.getPortSecurityEnabled() != null) {