summaryrefslogtreecommitdiffstats
path: root/v3po
diff options
context:
space:
mode:
authorMarek Gradzki <mgradzki@cisco.com>2016-12-13 14:01:31 +0100
committerMarek Gradzki <mgradzki@cisco.com>2016-12-14 12:29:58 +0100
commitbbdedfea03d7977165c662fdbb9c4df645df3708 (patch)
tree93c34014cc94854326d66711c18a76a119cccda2 /v3po
parenta5defc544b5664b138ecb51340c375bb664d6b52 (diff)
HONEYCOMB-177: expose device instance attribute
Change-Id: I7a1a5a2d338c39bb7a5f869660fcce06ef59515d Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
Diffstat (limited to 'v3po')
-rw-r--r--v3po/api/src/main/yang/v3po.yang10
-rw-r--r--v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfaces/VhostUserCustomizer.java20
2 files changed, 24 insertions, 6 deletions
diff --git a/v3po/api/src/main/yang/v3po.yang b/v3po/api/src/main/yang/v3po.yang
index 7f093c9fc..d1af6114c 100644
--- a/v3po/api/src/main/yang/v3po.yang
+++ b/v3po/api/src/main/yang/v3po.yang
@@ -338,6 +338,15 @@ module v3po {
description "vhost-user settings";
}
+ grouping vhost-user-interface-config-attributes {
+ leaf device-instance {
+ type uint32;
+ mandatory false;
+ description "Custom device instance. Autogenerated will be used if not configured";
+ }
+ description "vhost-user settings";
+ }
+
grouping vhost-user-interface-state-attributes {
leaf features {
type uint64;
@@ -552,6 +561,7 @@ module v3po {
container vhost-user {
when "../if:type = 'v3po:vhost-user'";
uses vhost-user-interface-base-attributes;
+ uses vhost-user-interface-config-attributes;
}
container vxlan {
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfaces/VhostUserCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfaces/VhostUserCustomizer.java
index dc8fade2b..152e6d1c0 100644
--- a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfaces/VhostUserCustomizer.java
+++ b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfaces/VhostUserCustomizer.java
@@ -85,9 +85,13 @@ public class VhostUserCustomizer extends AbstractInterfaceTypeCustomizer<VhostUs
CreateVhostUserIf request = new CreateVhostUserIf();
request.isServer = booleanToByte(VhostUserRole.Server.equals(vhostUser.getRole()));
request.sockFilename = vhostUser.getSocket().getBytes();
- // TODO HONEYCOMB-177 expose device instance attribute just like for TAP
- request.renumber = 0;
- request.customDevInstance = 0;
+ final Long deviceInstance = vhostUser.getDeviceInstance();
+ if (deviceInstance == null) {
+ request.renumber = 0;
+ } else {
+ request.renumber = 1;
+ request.customDevInstance = Math.toIntExact(deviceInstance);
+ }
request.useCustomMac = 0;
request.macAddress = new byte[]{};
return request;
@@ -120,9 +124,13 @@ public class VhostUserCustomizer extends AbstractInterfaceTypeCustomizer<VhostUs
ModifyVhostUserIf request = new ModifyVhostUserIf();
request.isServer = booleanToByte(VhostUserRole.Server.equals(vhostUser.getRole()));
request.sockFilename = vhostUser.getSocket().getBytes();
- // TODO HONEYCOMB-177
- request.renumber = 0;
- request.customDevInstance = 0;
+ final Long deviceInstance = vhostUser.getDeviceInstance();
+ if (deviceInstance == null) {
+ request.renumber = 0;
+ } else {
+ request.renumber = 1;
+ request.customDevInstance = Math.toIntExact(deviceInstance);
+ }
request.swIfIndex = swIfIndex;
return request;
}