use of org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.binding.rev150712.PortBindingExtension in project netvirt by opendaylight.
the class NeutronUtils method isPortVnicTypeNormal.
public static boolean isPortVnicTypeNormal(Port port) {
PortBindingExtension portBinding = port.getAugmentation(PortBindingExtension.class);
if (portBinding == null || portBinding.getVnicType() == null) {
// By default, VNIC_TYPE is NORMAL
return true;
}
String vnicType = portBinding.getVnicType().trim().toLowerCase(Locale.getDefault());
return vnicType.equals(VNIC_TYPE_NORMAL);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.binding.rev150712.PortBindingExtension in project netvirt by opendaylight.
the class DhcpNeutronPortListener method isVnicTypeDirectOrMacVtap.
private boolean isVnicTypeDirectOrMacVtap(Port port) {
PortBindingExtension portBinding = port.getAugmentation(PortBindingExtension.class);
if (portBinding == null || portBinding.getVnicType() == null) {
// By default, VNIC_TYPE is NORMAL
return false;
}
String vnicType = portBinding.getVnicType().trim().toLowerCase(Locale.getDefault());
return vnicType.equals("direct") || vnicType.equals("macvtap");
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.binding.rev150712.PortBindingExtension in project netvirt by opendaylight.
the class NeutronPortChangeListener method isPortTypeSwitchdev.
private boolean isPortTypeSwitchdev(final Port port) {
if (!isPortVnicTypeDirect(port)) {
return false;
}
PortBindingExtension portBinding = port.getAugmentation(PortBindingExtension.class);
String profile = portBinding.getProfile();
if (profile == null || profile.isEmpty()) {
LOG.debug("Port {} has no binding:profile values", port.getUuid());
return false;
}
Map<String, JsonElement> mapProfile = unmarshal(profile);
JsonElement capabilities = mapProfile.get(NeutronConstants.BINDING_PROFILE_CAPABILITIES);
LOG.debug("Port {} capabilities: {}", port.getUuid(), capabilities);
if (capabilities == null || !capabilities.isJsonArray()) {
LOG.debug("binding profile capabilities not in array format: {}", capabilities);
return false;
}
JsonArray capabilitiesArray = capabilities.getAsJsonArray();
Gson gson = new Gson();
JsonElement switchdevElement = gson.fromJson(NeutronConstants.SWITCHDEV, JsonElement.class);
return capabilitiesArray.contains(switchdevElement);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.binding.rev150712.PortBindingExtension in project netvirt by opendaylight.
the class NeutronPortChangeListener method isPortVnicTypeDirect.
private boolean isPortVnicTypeDirect(Port port) {
PortBindingExtension portBinding = port.getAugmentation(PortBindingExtension.class);
if (portBinding == null || portBinding.getVnicType() == null) {
// By default, VNIC_TYPE is NORMAL
return false;
}
String vnicType = portBinding.getVnicType().trim().toLowerCase(Locale.getDefault());
return vnicType.equals(NeutronConstants.VNIC_TYPE_DIRECT);
}
Aggregations