use of org.onosproject.openstacknetworking.api.OpenstackNetwork.Type in project onos by opennetworkinglab.
the class OpenstackSwitchingIcmpHandler method processRouterIntfEvent.
private void processRouterIntfEvent(Router osRouter, RouterInterface routerIface, boolean install) {
if (!getStatefulSnatFlag()) {
return;
}
Subnet osSubnet = osNetworkService.subnet(routerIface.getSubnetId());
Type netType = osNetworkService.networkType(osSubnet.getNetworkId());
String segId = osNetworkService.segmentId(osSubnet.getNetworkId());
IpAddress gatewayIp = IpAddress.valueOf(osSubnet.getGateway());
Set<Subnet> routableSubnets = routableSubnets(osRouter, osSubnet.getId());
osNodeService.completeNodes(COMPUTE).stream().filter(cNode -> cNode.dataIp() != null).forEach(cNode -> {
setRoutableSubnetsIcmpRules(cNode, segId, osSubnet, routableSubnets, gatewayIp, netType, install);
});
}
use of org.onosproject.openstacknetworking.api.OpenstackNetwork.Type in project onos by opennetworkinglab.
the class OpenstackNetworkingUtil method traceRequestString.
/**
* Creates flow trace request string.
*
* @param srcIp src ip address
* @param dstIp dst ip address
* @param srcInstancePort src instance port
* @param osNetService openstack networking service
* @param uplink true if this request is for uplink
* @return flow trace request string
*/
public static String traceRequestString(String srcIp, String dstIp, InstancePort srcInstancePort, OpenstackNetworkService osNetService, boolean uplink) {
StringBuilder requestStringBuilder = new StringBuilder(DEFAULT_REQUEST_STRING);
if (uplink) {
requestStringBuilder.append(COMMA).append(IN_PORT).append(srcInstancePort.portNumber().toString()).append(COMMA).append(NW_SRC).append(srcIp).append(COMMA);
String modifiedDstIp = dstIp;
Type netType = osNetService.networkType(srcInstancePort.networkId());
if (netType == Type.VXLAN || netType == Type.GRE || netType == Type.VLAN || netType == Type.GENEVE) {
if (srcIp.equals(dstIp)) {
modifiedDstIp = osNetService.gatewayIp(srcInstancePort.portId());
requestStringBuilder.append(DL_DST).append(DEFAULT_GATEWAY_MAC_STR).append(COMMA);
} else if (!osNetService.ipPrefix(srcInstancePort.portId()).contains(IpAddress.valueOf(dstIp))) {
requestStringBuilder.append(DL_DST).append(DEFAULT_GATEWAY_MAC_STR).append(COMMA);
}
} else {
if (srcIp.equals(dstIp)) {
modifiedDstIp = osNetService.gatewayIp(srcInstancePort.portId());
}
}
requestStringBuilder.append(NW_DST).append(modifiedDstIp).append("\n");
} else {
requestStringBuilder.append(COMMA).append(NW_SRC).append(dstIp).append(COMMA);
Type netType = osNetService.networkType(srcInstancePort.networkId());
if (netType == Type.VXLAN || netType == Type.GRE || netType == Type.VLAN || netType == Type.GENEVE) {
requestStringBuilder.append(TUN_ID).append(osNetService.segmentId(srcInstancePort.networkId())).append(COMMA);
}
requestStringBuilder.append(NW_DST).append(srcIp).append("\n");
}
return requestStringBuilder.toString();
}
Aggregations