use of org.onosproject.net.behaviour.InterfaceConfig in project onos by opennetworkinglab.
the class DefaultK8sNodeHandler method createTunnelInterface.
/**
* Creates a tunnel interface in a given kubernetes node.
*
* @param k8sNode kubernetes node
*/
private void createTunnelInterface(K8sNode k8sNode, String type, String intfName) {
if (isIntfEnabled(k8sNode, intfName)) {
return;
}
Device device = deviceService.getDevice(k8sNode.ovsdb());
if (device == null || !device.is(InterfaceConfig.class)) {
log.error("Failed to create tunnel interface on {}", k8sNode.ovsdb());
return;
}
TunnelDescription tunnelDesc = buildTunnelDesc(k8sNode, 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 DefaultK8sHostHandler method createInterPatchInterfaces.
private void createInterPatchInterfaces(DeviceId ovsdb, K8sNode k8sNode) {
Device device = deviceService.getDevice(ovsdb);
if (device == null || !device.is(InterfaceConfig.class)) {
log.error("Failed to create patch interface on {}", ovsdb);
return;
}
InterfaceConfig ifaceConfig = device.as(InterfaceConfig.class);
// openstack integration bridge -> k8s integration bridge
PatchDescription osIntK8sIntPatchDesc = DefaultPatchDescription.builder().deviceId(OS_INTEGRATION_BRIDGE).ifaceName(k8sNode.osToK8sIntgPatchPortName()).peer(k8sNode.k8sIntgToOsPatchPortName()).build();
ifaceConfig.addPatchMode(k8sNode.osToK8sIntgPatchPortName(), osIntK8sIntPatchDesc);
// openstack integration bridge -> k8s external bridge
PatchDescription osIntK8sExPatchDesc = DefaultPatchDescription.builder().deviceId(OS_INTEGRATION_BRIDGE).ifaceName(k8sNode.osToK8sExtPatchPortName()).peer(k8sNode.k8sExtToOsPatchPortName()).build();
ifaceConfig.addPatchMode(k8sNode.osToK8sExtPatchPortName(), osIntK8sExPatchDesc);
}
use of org.onosproject.net.behaviour.InterfaceConfig in project onos by opennetworkinglab.
the class DefaultKubevirtNodeHandler method createPhysicalPatchPorts.
private void createPhysicalPatchPorts(KubevirtNode node, KubevirtPhyInterface phyInterface) {
Device device = deviceService.getDevice(node.ovsdb());
if (device == null || !device.is(InterfaceConfig.class)) {
log.error("Failed to create patch interface on {}", node.ovsdb());
return;
}
String physicalDeviceId = BRIDGE_PREFIX + phyInterface.network();
String intToPhyPatchPort = structurePortName(INTEGRATION_TO_PHYSICAL_PREFIX + phyInterface.network());
String phyToIntPatchPort = structurePortName(phyInterface.network() + PHYSICAL_TO_INTEGRATION_SUFFIX);
// integration bridge -> physical bridge
PatchDescription intToPhyPatchDesc = DefaultPatchDescription.builder().deviceId(INTEGRATION_BRIDGE).ifaceName(intToPhyPatchPort).peer(phyToIntPatchPort).build();
// physical bridge -> integration bridge
PatchDescription phyToIntPatchDesc = DefaultPatchDescription.builder().deviceId(physicalDeviceId).ifaceName(phyToIntPatchPort).peer(intToPhyPatchPort).build();
InterfaceConfig ifaceConfig = device.as(InterfaceConfig.class);
ifaceConfig.addPatchMode(INTEGRATION_TO_PHYSICAL_PREFIX + phyInterface.network(), intToPhyPatchDesc);
ifaceConfig.addPatchMode(phyInterface.network() + PHYSICAL_TO_INTEGRATION_SUFFIX, phyToIntPatchDesc);
addOrRemoveSystemInterface(node, physicalDeviceId, phyInterface.intf(), deviceService, true);
}
use of org.onosproject.net.behaviour.InterfaceConfig in project onos by opennetworkinglab.
the class DefaultKubevirtNodeHandler method removePhysicalPatchPorts.
private void removePhysicalPatchPorts(KubevirtNode node, String network) {
Device device = deviceService.getDevice(node.ovsdb());
if (device == null || !device.is(InterfaceConfig.class)) {
log.error("Failed to remove patch interface on {}", node.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 DefaultKubevirtNodeHandler method createPatchInterfaceBetweenBrIntBrTun.
private void createPatchInterfaceBetweenBrIntBrTun(KubevirtNode node) {
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);
// int bridge -> tunnel bridge
PatchDescription brIntTunPatchDesc = DefaultPatchDescription.builder().deviceId(INTEGRATION_BRIDGE).ifaceName(INTEGRATION_TO_TUNNEL).peer(TUNNEL_TO_INTEGRATION).build();
ifaceConfig.addPatchMode(INTEGRATION_TO_TUNNEL, brIntTunPatchDesc);
// tunnel bridge -> int bridge
PatchDescription brTunIntPatchDesc = DefaultPatchDescription.builder().deviceId(TUNNEL_BRIDGE).ifaceName(TUNNEL_TO_INTEGRATION).peer(INTEGRATION_TO_TUNNEL).build();
ifaceConfig.addPatchMode(TUNNEL_TO_INTEGRATION, brTunIntPatchDesc);
}
Aggregations