use of org.onosproject.net.behaviour.InterfaceConfig in project onos by opennetworkinglab.
the class KubevirtNetworkHandler method removePatchInterface.
private void removePatchInterface(KubevirtNode node, KubevirtNetwork network) {
Device device = deviceService.getDevice(node.ovsdb());
if (device == null || !device.is(InterfaceConfig.class)) {
log.error("Failed to create patch interface on {}", node.ovsdb());
return;
}
InterfaceConfig ifaceConfig = device.as(InterfaceConfig.class);
String tunToIntIntf = TUNNEL_TO_TENANT_PREFIX + segmentIdHex(network.segmentId());
ifaceConfig.removePatchMode(tunToIntIntf);
}
use of org.onosproject.net.behaviour.InterfaceConfig in project onos by opennetworkinglab.
the class KubevirtNetworkHandler method createPatchTenantInterface.
private void createPatchTenantInterface(KubevirtNode node, KubevirtNetwork network) {
Device device = deviceService.getDevice(node.ovsdb());
if (device == null || !device.is(InterfaceConfig.class)) {
log.error("Failed to create patch interface on {}", node.ovsdb());
return;
}
InterfaceConfig ifaceConfig = device.as(InterfaceConfig.class);
String tenantToTunIntf = TENANT_TO_TUNNEL_PREFIX + segmentIdHex(network.segmentId());
String tunToTenantIntf = TUNNEL_TO_TENANT_PREFIX + segmentIdHex(network.segmentId());
if (!hasPort(network.tenantDeviceId(node.hostname()), tenantToTunIntf)) {
// patch ports for tenant bridge -> tunnel bridge
PatchDescription brTenantTunPatchDesc = DefaultPatchDescription.builder().deviceId(network.tenantBridgeName()).ifaceName(tenantToTunIntf).peer(tunToTenantIntf).build();
ifaceConfig.addPatchMode(tenantToTunIntf, brTenantTunPatchDesc);
waitFor(1);
}
if (!hasPort(node.tunBridge(), tunToTenantIntf)) {
// tunnel bridge -> tenant bridge
PatchDescription brTunTenantPatchDesc = DefaultPatchDescription.builder().deviceId(TUNNEL_BRIDGE).ifaceName(tunToTenantIntf).peer(tenantToTunIntf).build();
ifaceConfig.addPatchMode(tunToTenantIntf, brTunTenantPatchDesc);
waitFor(1);
}
}
use of org.onosproject.net.behaviour.InterfaceConfig in project onos by opennetworkinglab.
the class DefaultKubevirtNodeHandler method createTunnelInterface.
/**
* Creates a tunnel interface in a given kubernetes node.
*
* @param node kubevirt node
* @param type kubevirt type
* @param intfName tunnel interface name
*/
private void createTunnelInterface(KubevirtNode node, String type, String intfName) {
if (isIntfEnabled(node, intfName)) {
return;
}
Device device = deviceService.getDevice(node.ovsdb());
if (device == null || !device.is(InterfaceConfig.class)) {
log.error("Failed to create tunnel interface on {}", node.ovsdb());
return;
}
TunnelDescription tunnelDesc = buildTunnelDesc(type, intfName);
InterfaceConfig ifaceConfig = device.as(InterfaceConfig.class);
ifaceConfig.addTunnelMode(intfName, tunnelDesc);
}
use of org.onosproject.net.behaviour.InterfaceConfig in project onos by opennetworkinglab.
the class DefaultOpenstackNodeHandler method removePhysicalPatchPorts.
private void removePhysicalPatchPorts(OpenstackNode osNode, String network) {
Device device = deviceService.getDevice(osNode.ovsdb());
if (device == null || !device.is(InterfaceConfig.class)) {
log.error("Failed to remove patch interface on {}", osNode.ovsdb());
return;
}
String intToPhyPatchPort = structurePortName(INTEGRATION_TO_PHYSICAL_PREFIX + network);
InterfaceConfig ifaceConfig = device.as(InterfaceConfig.class);
ifaceConfig.removePatchMode(intToPhyPatchPort);
}
use of org.onosproject.net.behaviour.InterfaceConfig in project onos by opennetworkinglab.
the class DefaultOpenstackNodeHandler method createTunnelInterface.
/**
* Creates a tunnel interface in a given openstack node.
*
* @param osNode openstack node
*/
private void createTunnelInterface(OpenstackNode osNode, String type, String intfName) {
if (isIntfEnabled(osNode, intfName)) {
return;
}
Device device = deviceService.getDevice(osNode.ovsdb());
if (device == null || !device.is(InterfaceConfig.class)) {
log.error("Failed to create tunnel interface on {}", osNode.ovsdb());
return;
}
TunnelDescription tunnelDesc = buildTunnelDesc(type, intfName);
InterfaceConfig ifaceConfig = device.as(InterfaceConfig.class);
ifaceConfig.addTunnelMode(intfName, tunnelDesc);
}
Aggregations