use of org.onosproject.kubevirtnode.api.KubevirtNode in project onos by opennetworkinglab.
the class DefaultKubevirtPort method tenantDeviceId.
@Override
public DeviceId tenantDeviceId() {
KubevirtNetworkService networkService = DefaultServiceDirectory.getService(KubevirtNetworkService.class);
KubevirtNodeService nodeService = DefaultServiceDirectory.getService(KubevirtNodeService.class);
KubevirtNetwork network = networkService.network(networkId);
KubevirtNode node = nodeService.node(deviceId);
if (network == null || node == null) {
return null;
} else {
return network.tenantDeviceId(node.hostname());
}
}
use of org.onosproject.kubevirtnode.api.KubevirtNode in project onos by opennetworkinglab.
the class KubevirtSyncRulesCommand method syncRulesBaseForNode.
private void syncRulesBaseForNode(KubevirtNodeAdminService service, KubevirtNode node) {
KubevirtNode updated = node.updateState(INIT);
service.updateNode(updated);
boolean result = true;
long timeoutExpiredMs = System.currentTimeMillis() + TIMEOUT_MS;
while (service.node(node.hostname()).state() != COMPLETE) {
long waitMs = timeoutExpiredMs - System.currentTimeMillis();
waitFor(SLEEP_S);
if (waitMs <= 0) {
result = false;
break;
}
}
if (result) {
print(SUCCESS_MSG, node.hostname());
} else {
error(FAIL_MSG, node.hostname());
}
}
use of org.onosproject.kubevirtnode.api.KubevirtNode in project onos by opennetworkinglab.
the class KubevirtNetworkHandler method setDefaultEgressRuleToGatewayNode.
private void setDefaultEgressRuleToGatewayNode(KubevirtRouter router, KubevirtNetwork network, DeviceId gwDeviceId, boolean install) {
MacAddress routerMacAddress = getRouterMacAddress(router);
if (routerMacAddress == null) {
log.warn("Setting gateway default eggress rule to gateway for tenant internal network because " + "there's no br-int port for device {}", gwDeviceId);
return;
}
KubevirtNode gwNode = kubevirtNodeService.node(gwDeviceId);
if (gwNode == null) {
log.warn("Setting gateway default eggress rule to gateway for tenant internal network because " + "there's no gateway node for device {}", gwDeviceId);
return;
}
PortNumber tunToIntPortNum = portNumber(deviceService, gwNode.tunBridge(), TUNNEL_TO_INTEGRATION);
TrafficSelector.Builder sBuilder = DefaultTrafficSelector.builder().matchTunnelId(Long.parseLong(network.segmentId()));
TrafficTreatment.Builder tBuilder = DefaultTrafficTreatment.builder().setOutput(tunToIntPortNum);
flowService.setRule(appId, gwNode.tunBridge(), sBuilder.build(), tBuilder.build(), PRIORITY_TUNNEL_RULE, TUNNEL_DEFAULT_TABLE, install);
}
use of org.onosproject.kubevirtnode.api.KubevirtNode in project onos by opennetworkinglab.
the class KubevirtNetworkHandler method setGatewayRuleToWorkerNodeWhenNodeCreated.
private void setGatewayRuleToWorkerNodeWhenNodeCreated(KubevirtNode node, KubevirtNetwork network) {
KubevirtRouter router = getRouterForKubevirtNetwork(kubevirtRouterService, network);
if (router == null) {
return;
}
KubevirtNode electedGw = gatewayNodeForSpecifiedRouter(nodeService, router);
if (electedGw == null) {
return;
}
setDefaultGatewayRuleToWorkerNodeTunBridge(router, network, electedGw.intgBridge(), node, true);
}
use of org.onosproject.kubevirtnode.api.KubevirtNode in project onos by opennetworkinglab.
the class KubevirtNetworkHandler method setGatewayArpRulesForTenantNetwork.
private void setGatewayArpRulesForTenantNetwork(KubevirtNode node, KubevirtNetwork network) {
KubevirtRouter router = getRouterForKubevirtNetwork(kubevirtRouterService, network);
if (router == null) {
return;
}
KubevirtNode electedGw = gatewayNodeForSpecifiedRouter(nodeService, router);
if (electedGw == null) {
return;
}
setGatewayArpRuleForTenantInternalNetwork(router, network, TENANT_ARP_TABLE, electedGw.intgBridge(), network.tenantDeviceId(node.hostname()), true);
}
Aggregations