use of org.onosproject.net.behaviour.InterfaceConfig in project onos by opennetworkinglab.
the class DefaultK8sNodeHandler method createPatchInterfaces.
private void createPatchInterfaces(K8sNode k8sNode) {
Device device = deviceService.getDevice(k8sNode.ovsdb());
if (device == null || !device.is(InterfaceConfig.class)) {
log.error("Failed to create patch interface on {}", k8sNode.ovsdb());
return;
}
// integration bridge -> external bridge
PatchDescription brIntExtPatchDesc = DefaultPatchDescription.builder().deviceId(k8sNode.intgBridgeName()).ifaceName(k8sNode.intgToExtPatchPortName()).peer(k8sNode.extToIntgPatchPortName()).build();
// integration bridge -> tunnel bridge
PatchDescription brIntTunPatchDesc = DefaultPatchDescription.builder().deviceId(k8sNode.intgBridgeName()).ifaceName(k8sNode.intgToTunPatchPortName()).peer(k8sNode.tunToIntgPatchPortName()).build();
// external bridge -> integration bridge
PatchDescription brExtIntPatchDesc = DefaultPatchDescription.builder().deviceId(k8sNode.extBridgeName()).ifaceName(k8sNode.extToIntgPatchPortName()).peer(k8sNode.intgToExtPatchPortName()).build();
// integration bridge -> local bridge
PatchDescription brIntLocalPatchDesc = DefaultPatchDescription.builder().deviceId(k8sNode.intgBridgeName()).ifaceName(k8sNode.intgToLocalPatchPortName()).peer(k8sNode.localToIntgPatchPortName()).build();
// local bridge -> integration bridge
PatchDescription brLocalIntPatchDesc = DefaultPatchDescription.builder().deviceId(k8sNode.localBridgeName()).ifaceName(k8sNode.localToIntgPatchPortName()).peer(k8sNode.intgToLocalPatchPortName()).build();
InterfaceConfig ifaceConfig = device.as(InterfaceConfig.class);
ifaceConfig.addPatchMode(k8sNode.intgToExtPatchPortName(), brIntExtPatchDesc);
ifaceConfig.addPatchMode(k8sNode.extToIntgPatchPortName(), brExtIntPatchDesc);
ifaceConfig.addPatchMode(k8sNode.intgToLocalPatchPortName(), brIntLocalPatchDesc);
ifaceConfig.addPatchMode(k8sNode.localToIntgPatchPortName(), brLocalIntPatchDesc);
ifaceConfig.addPatchMode(k8sNode.intgToTunPatchPortName(), brIntTunPatchDesc);
if (k8sNode.mode() == NORMAL) {
// tunnel bridge -> integration bridge
PatchDescription brTunIntPatchDesc = DefaultPatchDescription.builder().deviceId(k8sNode.tunBridgeName()).ifaceName(k8sNode.tunToIntgPatchPortName()).peer(k8sNode.intgToTunPatchPortName()).build();
ifaceConfig.addPatchMode(k8sNode.tunToIntgPatchPortName(), brTunIntPatchDesc);
} else {
// k8s integration bridge -> openstack integration bridge
PatchDescription k8sIntOsIntPatchDesc = DefaultPatchDescription.builder().deviceId(k8sNode.intgBridgeName()).ifaceName(k8sNode.k8sIntgToOsPatchPortName()).peer(k8sNode.osToK8sIntgPatchPortName()).build();
ifaceConfig.addPatchMode(k8sNode.k8sIntgToOsPatchPortName(), k8sIntOsIntPatchDesc);
// k8s external bridge -> openstack integration bridge
PatchDescription k8sExtOsIntPatchDesc = DefaultPatchDescription.builder().deviceId(k8sNode.extBridgeName()).ifaceName(k8sNode.k8sExtToOsPatchPortName()).peer(k8sNode.osToK8sExtPatchPortName()).build();
ifaceConfig.addPatchMode(k8sNode.k8sExtToOsPatchPortName(), k8sExtOsIntPatchDesc);
// external bridge -> router bridge
PatchDescription extRouterPatchDesc = DefaultPatchDescription.builder().deviceId(k8sNode.extBridgeName()).ifaceName(k8sNode.extToRouterPatchPortName()).peer(k8sNode.routerToExtPatchPortName()).build();
ifaceConfig.addPatchMode(k8sNode.extToRouterPatchPortName(), extRouterPatchDesc);
}
}
use of org.onosproject.net.behaviour.InterfaceConfig in project onos by opennetworkinglab.
the class DefaultK8sHostHandler method createTunnelInterface.
private void createTunnelInterface(DeviceId ovsdb, K8sTunnelBridge bridge, String type, String intfName) {
if (isTunPortEnabled(bridge, intfName)) {
return;
}
Device device = deviceService.getDevice(ovsdb);
if (device == null || !device.is(InterfaceConfig.class)) {
log.error("Failed to create tunnel interface on {}", ovsdb);
return;
}
TunnelDescription tunnelDesc = buildTunnelDesc(bridge, 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 createRouterPatchInterfaces.
private void createRouterPatchInterfaces(DeviceId ovsdb, K8sBridge bridge, 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);
// router bridge -> external bridge
PatchDescription brRouterExtPatchDesc = DefaultPatchDescription.builder().deviceId(bridge.name()).ifaceName(k8sNode.routerToExtPatchPortName()).peer(k8sNode.extToRouterPatchPortName()).build();
ifaceConfig.addPatchMode(k8sNode.tunToIntgPatchPortName(), brRouterExtPatchDesc);
}
use of org.onosproject.net.behaviour.InterfaceConfig in project onos by opennetworkinglab.
the class DefaultK8sHostHandler method createTunnelPatchInterfaces.
private void createTunnelPatchInterfaces(DeviceId ovsdb, K8sBridge bridge, 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);
// tunnel bridge -> k8s integration bridge
PatchDescription brTunIntPatchDesc = DefaultPatchDescription.builder().deviceId(bridge.name()).ifaceName(k8sNode.tunToIntgPatchPortName()).peer(k8sNode.intgToTunPatchPortName()).build();
ifaceConfig.addPatchMode(k8sNode.tunToIntgPatchPortName(), brTunIntPatchDesc);
}
Aggregations