import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier.PathArgument;
import org.opendaylight.yangtools.yang.common.RpcResult;
+import org.opendaylight.yangtools.yang.common.Uint16;
+import org.opendaylight.yangtools.yang.common.Uint32;
+import org.opendaylight.yangtools.yang.common.Uint64;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
getCookieSnatFlow() computes and returns a unique cookie value for the NAT flows using the router ID as the
reference value.
*/
- public static BigInteger getCookieSnatFlow(long routerId) {
- return NatConstants.COOKIE_NAPT_BASE.add(new BigInteger("0110000", 16)).add(
- BigInteger.valueOf(routerId));
+ public static Uint64 getCookieSnatFlow(long routerId) {
+ return Uint64.valueOf(NatConstants.COOKIE_NAPT_BASE.toJava().add(new BigInteger("0110000", 16)).add(
+ BigInteger.valueOf(routerId)));
}
/*
getCookieNaptFlow() computes and returns a unique cookie value for the NAPT flows using the router ID as the
reference value.
*/
- public static BigInteger getCookieNaptFlow(long routerId) {
- return NatConstants.COOKIE_NAPT_BASE.add(new BigInteger("0111000", 16)).add(
- BigInteger.valueOf(routerId));
+ public static Uint64 getCookieNaptFlow(Uint32 routerId) {
+ return Uint64.valueOf(NatConstants.COOKIE_NAPT_BASE.toJava().add(new BigInteger("0111000", 16)).add(
+ BigInteger.valueOf(routerId.longValue())));
}
/*
getVpnId() returns the VPN ID from the VPN name
*/
- public static long getVpnId(DataBroker broker, @Nullable String vpnName) {
+ public static Uint32 getVpnId(DataBroker broker, @Nullable String vpnName) {
if (vpnName == null) {
return NatConstants.INVALID_ID;
}
SingleTransactionDataBroker.syncReadOptionalAndTreatReadFailedExceptionAsAbsentOptional(broker,
LogicalDatastoreType.CONFIGURATION, id);
- long vpnId = NatConstants.INVALID_ID;
+ Uint32 vpnId = NatConstants.INVALID_ID;
if (vpnInstance.isPresent()) {
- Long vpnIdAsLong = vpnInstance.get().getVpnId();
+ Uint32 vpnIdAsLong = vpnInstance.get().getVpnId();
if (vpnIdAsLong != null) {
vpnId = vpnIdAsLong;
}
return vpnId;
}
- public static long getVpnId(TypedReadTransaction<Configuration> confTx, String vpnName) {
+ public static Uint32 getVpnId(TypedReadTransaction<Configuration> confTx, String vpnName) {
if (vpnName == null) {
return NatConstants.INVALID_ID;
}
try {
return confTx.read(getVpnInstanceToVpnIdIdentifier(vpnName)).get().toJavaUtil().map(
org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.instance.to.vpn.id
- .VpnInstance::getVpnId).orElse(Long.valueOf(NatConstants.INVALID_ID));
+ .VpnInstance::getVpnId).orElse(NatConstants.INVALID_ID);
} catch (InterruptedException | ExecutionException e) {
LOG.error("Error retrieving VPN id for {}", vpnName, e);
}
return NatConstants.INVALID_ID;
}
- public static Long getNetworkVpnIdFromRouterId(DataBroker broker, long routerId) {
+ public static Uint32 getNetworkVpnIdFromRouterId(DataBroker broker, Uint32 routerId) {
//Get the external network ID from the ExternalRouter model
Uuid networkId = NatUtil.getNetworkIdFromRouterId(broker, routerId);
if (networkId == null) {
LOG.error("getNetworkVpnIdFromRouterId : networkId is null");
- return Long.valueOf(NatConstants.INVALID_ID);
+ return NatConstants.INVALID_ID;
}
//Get the VPN ID from the ExternalNetworks model
Uuid vpnUuid = NatUtil.getVpnIdfromNetworkId(broker, networkId);
if (vpnUuid == null) {
LOG.error("getNetworkVpnIdFromRouterId : vpnUuid is null");
- return Long.valueOf(NatConstants.INVALID_ID);
+ return NatConstants.INVALID_ID;
}
- Long vpnId = NatUtil.getVpnId(broker, vpnUuid.getValue());
+ Uint32 vpnId = NatUtil.getVpnId(broker, vpnUuid.getValue());
return vpnId;
}
}
@Nullable
- static String getVpnInstanceFromVpnIdentifier(DataBroker broker, long vpnId) {
+ static String getVpnInstanceFromVpnIdentifier(DataBroker broker, Uint32 vpnId) {
InstanceIdentifier<VpnIds> id = InstanceIdentifier.builder(VpnIdToVpnInstance.class)
.child(VpnIds.class, new VpnIdsKey(vpnId)).build();
return SingleTransactionDataBroker.syncReadOptionalAndTreatReadFailedExceptionAsAbsentOptional(broker,
/*
getFlowRef() returns a string identfier for the SNAT flows using the router ID as the reference.
*/
- public static String getFlowRef(BigInteger dpnId, short tableId, long routerID, String ip) {
+ public static String getFlowRef(Uint64 dpnId, short tableId, Uint32 routerID, String ip) {
return new StringBuilder().append(NatConstants.NAPT_FLOWID_PREFIX).append(dpnId)
.append(NatConstants.FLOWID_SEPARATOR).append(tableId).append(NatConstants.FLOWID_SEPARATOR)
.append(routerID).append(NatConstants.FLOWID_SEPARATOR).append(ip).toString();
}
- public static String getFlowRef(BigInteger dpnId, short tableId, InetAddress destPrefix, long vpnId) {
+ public static String getFlowRef(Uint64 dpnId, short tableId, InetAddress destPrefix, Uint32 vpnId) {
return new StringBuilder().append(NatConstants.NAPT_FLOWID_PREFIX).append(dpnId)
.append(NatConstants.FLOWID_SEPARATOR).append(tableId).append(NatConstants.FLOWID_SEPARATOR)
.append(destPrefix.getHostAddress()).append(NatConstants.FLOWID_SEPARATOR).append(vpnId).toString();
}
- public static String getNaptFlowRef(BigInteger dpnId, short tableId, String routerID, String ip,
+ public static String getNaptFlowRef(Uint64 dpnId, short tableId, String routerID, String ip,
int port, String protocol) {
return new StringBuilder().append(NatConstants.NAPT_FLOWID_PREFIX).append(dpnId)
.append(NatConstants.FLOWID_SEPARATOR).append(tableId).append(NatConstants.FLOWID_SEPARATOR)
}
@Nullable
- static Uuid getNetworkIdFromRouterId(DataBroker broker, long routerId) {
+ static Uuid getNetworkIdFromRouterId(DataBroker broker, Uint32 routerId) {
String routerName = getRouterName(broker, routerId);
if (routerName == null) {
LOG.error("getNetworkIdFromRouterId - empty routerName received");
return routerInstanceIndentifier;
}
- private static InstanceIdentifier<RouterIds> buildRouterIdentifier(Long routerId) {
+ private static InstanceIdentifier<RouterIds> buildRouterIdentifier(Uint32 routerId) {
InstanceIdentifier<RouterIds> routerIds = InstanceIdentifier.builder(RouterIdName.class)
.child(RouterIds.class, new RouterIdsKey(routerId)).build();
return routerIds;
}
@Nullable
- public static BigInteger getPrimaryNaptfromRouterId(DataBroker broker, Long routerId) {
+ public static Uint64 getPrimaryNaptfromRouterId(DataBroker broker, Uint32 routerId) {
// convert routerId to Name
String routerName = getRouterName(broker, routerId);
if (routerName == null) {
}
@Nullable
- public static BigInteger getPrimaryNaptfromRouterName(DataBroker broker, String routerName) {
+ public static Uint64 getPrimaryNaptfromRouterName(DataBroker broker, String routerName) {
if (routerName == null) {
LOG.error("getPrimaryNaptfromRouterName - empty routerName received");
return null;
}
InstanceIdentifier<RouterToNaptSwitch> id = buildNaptSwitchIdentifier(routerName);
- return SingleTransactionDataBroker.syncReadOptionalAndTreatReadFailedExceptionAsAbsentOptional(broker,
+ return (SingleTransactionDataBroker.syncReadOptionalAndTreatReadFailedExceptionAsAbsentOptional(broker,
LogicalDatastoreType.CONFIGURATION, id).toJavaUtil().map(RouterToNaptSwitch::getPrimarySwitchId).orElse(
- null);
+ Uint64.valueOf(0L)));
}
public static InstanceIdentifier<RouterToNaptSwitch> buildNaptSwitchIdentifier(String routerId) {
}
@Nullable
- public static String getRouterName(DataBroker broker, Long routerId) {
+ public static String getRouterName(DataBroker broker, Uint32 routerId) {
return getVpnInstanceFromVpnIdentifier(broker, routerId);
}
.child(VpnInstanceOpDataEntry.class, new VpnInstanceOpDataEntryKey(vrfId)).build();
}
- public static FlowEntity buildFlowEntity(BigInteger dpnId, short tableId, BigInteger cookie, String flowId) {
+ public static FlowEntity buildFlowEntity(Uint64 dpnId, short tableId, Uint64 cookie, String flowId) {
return new FlowEntityBuilder()
.setDpnId(dpnId)
.setTableId(tableId)
.build();
}
- public static FlowEntity buildFlowEntity(BigInteger dpnId, short tableId, String flowId) {
+ public static FlowEntity buildFlowEntity(Uint64 dpnId, short tableId, String flowId) {
return new FlowEntityBuilder()
.setDpnId(dpnId)
.setTableId(tableId)
}
@Nullable
- public static String getEndpointIpAddressForDPN(DataBroker broker, BigInteger dpnId) {
+ public static String getEndpointIpAddressForDPN(DataBroker broker, Uint64 dpnId) {
String nextHopIp = null;
InstanceIdentifier<DPNTEPsInfo> tunnelInfoId =
InstanceIdentifier.builder(DpnEndpoints.class)
}
@Nullable
- public static IpPortExternal getExternalIpPortMap(DataBroker broker, Long routerId, String internalIpAddress,
+ public static IpPortExternal getExternalIpPortMap(DataBroker broker, Uint32 routerId, String internalIpAddress,
String internalPort, NAPTEntryEvent.Protocol protocol) {
ProtocolTypes protocolType = NatUtil.getProtocolType(protocol);
InstanceIdentifier<IpPortMap> ipPortMapId =
null);
}
- private static InstanceIdentifier<IpPortMap> buildIpToPortMapIdentifier(Long routerId, String internalIpAddress,
+ private static InstanceIdentifier<IpPortMap> buildIpToPortMapIdentifier(Uint32 routerId, String internalIpAddress,
String internalPort,
ProtocolTypes protocolType) {
return InstanceIdentifier.builder(IntextIpPortMap.class)
return split[1];
}
- public static BigInteger getDpIdFromInterface(
+ public static Uint64 getDpIdFromInterface(
org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces
.state.Interface ifState) {
String lowerLayerIf = ifState.getLowerLayerIf().get(0);
NodeConnectorId nodeConnectorId = new NodeConnectorId(lowerLayerIf);
- return new BigInteger(getDpnFromNodeConnectorId(nodeConnectorId));
+ return Uint64.valueOf(getDpnFromNodeConnectorId(nodeConnectorId));
}
return null;
}
- static long getAssociatedVpn(DataBroker broker, String routerName) {
+ static Uint32 getAssociatedVpn(DataBroker broker, String routerName) {
InstanceIdentifier<Routermapping> routerMappingId = NatUtil.getRouterVpnMappingId(routerName);
return SingleTransactionDataBroker.syncReadOptionalAndTreatReadFailedExceptionAsAbsentOptional(broker,
LogicalDatastoreType.OPERATIONAL, routerMappingId).toJavaUtil().map(Routermapping::getVpnId).orElse(
- Long.valueOf(NatConstants.INVALID_ID));
+ NatConstants.INVALID_ID);
}
@Nullable
String nextHopIp,
@Nullable String parentVpnRd,
@Nullable String macAddress,
- long label,
- long l3vni,
+ Uint32 label,
+ Uint32 l3vni,
RouteOrigin origin,
- BigInteger dpId) {
+ Uint64 dpId) {
try {
LOG.info("addPrefixToBGP : Adding Fib entry rd {} prefix {} nextHop {} label {}", rd,
prefix, nextHopIp, label);
addPrefixToInterface(broker, getVpnId(broker, vpnName), null /*interfaceName*/,prefix, parentVpnRd,
dpId, Prefixes.PrefixCue.Nat);
+
fibManager.addOrUpdateFibEntry(rd, macAddress, prefix,
- Collections.singletonList(nextHopIp), VrfEntry.EncapType.Mplsgre, (int)label, l3vni /*l3vni*/,
+ Collections.singletonList(nextHopIp), VrfEntry.EncapType.Mplsgre, label, l3vni /*l3vni*/,
null /*gatewayMacAddress*/, parentVpnRd, origin, null /*writeTxn*/);
if (rd != null && !rd.equalsIgnoreCase(vpnName)) {
/* Publish to Bgp only if its an INTERNET VPN */
bgpManager.advertisePrefix(rd, null /*macAddress*/, prefix, Collections.singletonList(nextHopIp),
- VrfEntry.EncapType.Mplsgre, (int) label, 0 /*l3vni*/, 0 /*l2vni*/,
+ VrfEntry.EncapType.Mplsgre, label, Uint32.ZERO /*l3vni*/, Uint32.ZERO /*l2vni*/,
null /*gatewayMac*/);
}
LOG.info("addPrefixToBGP : Added Fib entry rd {} prefix {} nextHop {} label {}", rd,
}
}
- static void addPrefixToInterface(DataBroker broker, long vpnId, @Nullable String interfaceName, String ipPrefix,
- String networkId, BigInteger dpId, Prefixes.PrefixCue prefixCue) {
+ static void addPrefixToInterface(DataBroker broker, Uint32 vpnId, @Nullable String interfaceName, String ipPrefix,
+ String networkId, Uint64 dpId, Prefixes.PrefixCue prefixCue) {
InstanceIdentifier<Prefixes> prefixId = InstanceIdentifier.builder(PrefixToInterface.class)
.child(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.prefix.to._interface
.VpnIds.class, new org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.prefix
}
}
- public static void deletePrefixToInterface(DataBroker broker, long vpnId, String ipPrefix) {
+ public static void deletePrefixToInterface(DataBroker broker, Uint32 vpnId, String ipPrefix) {
try {
SingleTransactionDataBroker.syncDelete(broker, LogicalDatastoreType.OPERATIONAL,
InstanceIdentifier.builder(PrefixToInterface.class)
}
@NonNull
- public static List<Integer> getInternalIpPortListInfo(DataBroker dataBroker, Long routerId,
+ public static List<Uint16> getInternalIpPortListInfo(DataBroker dataBroker, Uint32 routerId,
String internalIpAddress, ProtocolTypes protocolType) {
return SingleTransactionDataBroker.syncReadOptionalAndTreatReadFailedExceptionAsAbsentOptional(dataBroker,
LogicalDatastoreType.CONFIGURATION,
IntIpProtoType::getPorts).orElse(emptyList());
}
- public static InstanceIdentifier<IntIpProtoType> buildSnatIntIpPortIdentifier(Long routerId,
+ public static InstanceIdentifier<IntIpProtoType> buildSnatIntIpPortIdentifier(Uint32 routerId,
String internalIpAddress,
ProtocolTypes protocolType) {
InstanceIdentifier<IntIpProtoType> intIpProtocolTypeId =
return "snatmiss." + routerName;
}
- public static int getUniqueId(IdManagerService idManager, String poolName, String idKey) {
+ public static Uint32 getUniqueId(IdManagerService idManager, String poolName, String idKey) {
AllocateIdInput getIdInput = (new AllocateIdInputBuilder()).setPoolName(poolName).setIdKey(idKey).build();
try {
Future<RpcResult<AllocateIdOutput>> result = idManager.allocateId(getIdInput);
RpcResult<AllocateIdOutput> rpcResult = (RpcResult)result.get();
- return rpcResult.isSuccessful() ? rpcResult.getResult().getIdValue().intValue() : NatConstants.INVALID_ID;
+ return rpcResult.isSuccessful() ? rpcResult.getResult().getIdValue()
+ : NatConstants.INVALID_ID;
} catch (InterruptedException | ExecutionException e) {
LOG.error("releaseId: Exception when releasing Id for key {} from pool {}", idKey, poolName, e);
}
return NatConstants.INVALID_ID;
}
- public static Integer releaseId(IdManagerService idManager, String poolName, String idKey) {
+ public static Uint32 releaseId(IdManagerService idManager, String poolName, String idKey) {
ReleaseIdInput idInput = new ReleaseIdInputBuilder().setPoolName(poolName).setIdKey(idKey).build();
try {
Future<RpcResult<ReleaseIdOutput>> result = idManager.releaseId(idInput);
poolName, idKey,
(result != null && result.get() != null) ? result.get().getErrors() : "RpcResult is null");
} else {
- return 1;
+ return Uint32.ONE;
}
} catch (InterruptedException | ExecutionException e) {
LOG.error("releaseId: Exception when releasing Id for key {} from pool {}", idKey, poolName, e);
}
@Nullable
- public static IpPortMapping getIportMapping(DataBroker broker, long routerId) {
+ public static IpPortMapping getIportMapping(DataBroker broker, Uint32 routerId) {
return SingleTransactionDataBroker.syncReadOptionalAndTreatReadFailedExceptionAsAbsentOptional(broker,
LogicalDatastoreType.CONFIGURATION, getIportMappingIdentifier(routerId)).orNull();
}
- public static InstanceIdentifier<IpPortMapping> getIportMappingIdentifier(long routerId) {
+ public static InstanceIdentifier<IpPortMapping> getIportMappingIdentifier(Uint32 routerId) {
return InstanceIdentifier.builder(IntextIpPortMap.class)
.child(IpPortMapping.class, new IpPortMappingKey(routerId)).build();
}
public static InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt
- .natservice.rev160111.intext.ip.map.IpMapping> getIpMappingBuilder(Long routerId) {
+ .natservice.rev160111.intext.ip.map.IpMapping> getIpMappingBuilder(Uint32 routerId) {
return InstanceIdentifier.builder(IntextIpMap.class)
.child(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.intext.ip.map
.IpMapping.class, new org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111
}
@NonNull
- public static Collection<String> getExternalIpsForRouter(DataBroker dataBroker, Long routerId) {
+ public static Collection<String> getExternalIpsForRouter(DataBroker dataBroker, Uint32 routerId) {
Optional<org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.intext
.ip.map.IpMapping> ipMappingOptional =
SingleTransactionDataBroker.syncReadOptionalAndTreatReadFailedExceptionAsAbsentOptional(dataBroker,
}
@NonNull
- public static Map<String, Long> getExternalIpsLabelForRouter(DataBroker dataBroker, Long routerId) {
+ public static Map<String, Uint32> getExternalIpsLabelForRouter(DataBroker dataBroker, Uint32 routerId) {
Optional<org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.intext
.ip.map.IpMapping> ipMappingOptional =
SingleTransactionDataBroker.syncReadOptionalAndTreatReadFailedExceptionAsAbsentOptional(dataBroker,
LogicalDatastoreType.OPERATIONAL, getIpMappingBuilder(routerId));
- Map<String, Long> externalIpsLabel = new HashMap<>();
+ Map<String, Uint32> externalIpsLabel = new HashMap<>();
if (ipMappingOptional.isPresent()) {
for (IpMap ipMap : ipMappingOptional.get().nonnullIpMap()) {
externalIpsLabel.put(ipMap.getExternalIp(), ipMap.getLabel());
}
@Nullable
- public static String getLeastLoadedExternalIp(DataBroker dataBroker, long segmentId) {
+ public static String getLeastLoadedExternalIp(DataBroker dataBroker, Uint32 segmentId) {
String leastLoadedExternalIp = null;
InstanceIdentifier<ExternalCounters> id =
InstanceIdentifier.builder(ExternalIpsCounter.class)
short countOfLstLoadExtIp = 32767;
for (ExternalIpCounter externalIpCounter : externalCounter.nonnullExternalIpCounter()) {
String curExternalIp = externalIpCounter.getExternalIp();
- short countOfCurExtIp = externalIpCounter.getCounter();
+ short countOfCurExtIp = externalIpCounter.getCounter().toJava();
if (countOfCurExtIp < countOfLstLoadExtIp) {
countOfLstLoadExtIp = countOfCurExtIp;
leastLoadedExternalIp = curExternalIp;
}
@NonNull
- public static List<BigInteger> getDpnsForRouter(DataBroker dataBroker, String routerUuid) {
+ public static List<Uint64> getDpnsForRouter(DataBroker dataBroker, String routerUuid) {
InstanceIdentifier id = InstanceIdentifier.builder(NeutronRouterDpns.class)
.child(RouterDpnList.class, new RouterDpnListKey(routerUuid)).build();
Optional<RouterDpnList> routerDpnListData =
SingleTransactionDataBroker.syncReadOptionalAndTreatReadFailedExceptionAsAbsentOptional(dataBroker,
LogicalDatastoreType.OPERATIONAL, id);
- List<BigInteger> dpns = new ArrayList<>();
+ List<Uint64> dpns = new ArrayList<>();
if (routerDpnListData.isPresent()) {
for (DpnVpninterfacesList dpnVpnInterface : routerDpnListData.get().nonnullDpnVpninterfacesList()) {
dpns.add(dpnVpnInterface.getDpnId());
return dpns;
}
- public static long getBgpVpnId(DataBroker dataBroker, String routerName) {
- long bgpVpnId = NatConstants.INVALID_ID;
+ public static Uint32 getBgpVpnId(DataBroker dataBroker, String routerName) {
+ Uint32 bgpVpnId = NatConstants.INVALID_ID;
Uuid bgpVpnUuid = NatUtil.getVpnForRouter(dataBroker, routerName);
if (bgpVpnUuid != null) {
bgpVpnId = NatUtil.getVpnId(dataBroker, bgpVpnUuid.getValue());
.RouterInterfaceKey(interfaceName)).build();
}
- public static void addToNeutronRouterDpnsMap(String routerName, String interfaceName, BigInteger dpId,
+ public static void addToNeutronRouterDpnsMap(String routerName, String interfaceName, Uint64 dpId,
TypedReadWriteTransaction<Operational> operTx) throws ExecutionException, InterruptedException {
- if (dpId.equals(BigInteger.ZERO)) {
+ if (dpId.equals(Uint64.ZERO)) {
LOG.warn("addToNeutronRouterDpnsMap : Could not retrieve dp id for interface {} "
+ "to handle router {} association model", interfaceName, routerName);
return;
}
}
- public static void addToDpnRoutersMap(String routerName, String interfaceName, BigInteger dpId,
+ public static void addToDpnRoutersMap(String routerName, String interfaceName, Uint64 dpId,
TypedReadWriteTransaction<Operational> operTx) throws ExecutionException, InterruptedException {
- if (dpId.equals(BigInteger.ZERO)) {
+ if (dpId.equals(Uint64.ZERO)) {
LOG.error("addToDpnRoutersMap : Could not retrieve dp id for interface {} to handle router {} "
+ "association model", interfaceName, routerName);
return;
}
}
- public static void removeFromNeutronRouterDpnsMap(String routerName, BigInteger dpId,
+ public static void removeFromNeutronRouterDpnsMap(String routerName, Uint64 dpId,
TypedReadWriteTransaction<Operational> operTx) throws ExecutionException, InterruptedException {
- if (dpId.equals(BigInteger.ZERO)) {
+ if (dpId.equals(Uint64.ZERO)) {
LOG.warn("removeFromNeutronRouterDpnsMap : DPN ID is invalid for the router {} ", routerName);
return;
}
}
public static void removeFromNeutronRouterDpnsMap(String routerName, String vpnInterfaceName,
- BigInteger dpId, @NonNull TypedReadWriteTransaction<Operational> operTx) {
+ Uint64 dpId, @NonNull TypedReadWriteTransaction<Operational> operTx) {
InstanceIdentifier<DpnVpninterfacesList> routerDpnListIdentifier = getRouterDpnId(routerName, dpId);
Optional<DpnVpninterfacesList> optionalRouterDpnList;
try {
}
public static void removeFromDpnRoutersMap(DataBroker broker, String routerName, String vpnInterfaceName,
- BigInteger curDpnId, OdlInterfaceRpcService ifaceMgrRpcService, TypedReadWriteTransaction<Operational> operTx)
+ Uint64 curDpnId, OdlInterfaceRpcService ifaceMgrRpcService, TypedReadWriteTransaction<Operational> operTx)
throws ExecutionException, InterruptedException {
/*
1) Get the DpnRoutersList for the DPN.
for (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.rev150602.router.interfaces.map
.router.interfaces.Interfaces vmInterface : vmInterfaces) {
String vmInterfaceName = vmInterface.getInterfaceId();
- BigInteger vmDpnId = getDpnForInterface(ifaceMgrRpcService, vmInterfaceName);
- if (vmDpnId.equals(BigInteger.ZERO) || !vmDpnId.equals(curDpnId)) {
+ Uint64 vmDpnId = getDpnForInterface(ifaceMgrRpcService, vmInterfaceName);
+ if (vmDpnId.equals(Uint64.ZERO) || !vmDpnId.equals(curDpnId)) {
LOG.debug("removeFromDpnRoutersMap : DPN ID {} for the removed interface {} is not the same as that of "
+ "the DPN ID {} for the checked interface {}",
curDpnId, vpnInterfaceName, vmDpnId, vmInterfaceName);
operTx.delete(routersListIdentifier);
}
- private static InstanceIdentifier<RoutersList> getRoutersList(BigInteger dpnId, String routerName) {
+ private static InstanceIdentifier<RoutersList> getRoutersList(Uint64 dpnId, String routerName) {
return InstanceIdentifier.builder(DpnRouters.class)
.child(DpnRoutersList.class, new DpnRoutersListKey(dpnId))
.child(RoutersList.class, new RoutersListKey(routerName)).build();
}
- public static BigInteger getDpnForInterface(OdlInterfaceRpcService interfaceManagerRpcService, String ifName) {
- BigInteger nodeId = BigInteger.ZERO;
+ public static Uint64 getDpnForInterface(OdlInterfaceRpcService interfaceManagerRpcService, String ifName) {
+ Uint64 nodeId = Uint64.ZERO;
try {
GetDpidFromInterfaceInput
dpIdInput =
public static List<ActionInfo> getEgressActionsForInterface(OdlInterfaceRpcService odlInterfaceRpcService,
ItmRpcService itmRpcService,
IInterfaceManager interfaceManager, String ifName,
- Long tunnelKey, boolean internalTunnelInterface) {
+ Uint32 tunnelKey, boolean internalTunnelInterface) {
return getEgressActionsForInterface(odlInterfaceRpcService, itmRpcService, interfaceManager,
ifName, tunnelKey, 0, internalTunnelInterface);
}
public static List<ActionInfo> getEgressActionsForInterface(OdlInterfaceRpcService odlInterfaceRpcService,
ItmRpcService itmRpcService,
IInterfaceManager interfaceManager,
- String ifName, @Nullable Long tunnelKey, int pos,
+ String ifName, @Nullable Uint32 tunnelKey, int pos,
boolean internalTunnelInterface) {
LOG.debug("getEgressActionsForInterface : called for interface {}", ifName);
GetEgressActionsForInterfaceInputBuilder egressActionsIfmBuilder =
} else if (actionClass instanceof SetFieldCase) {
if (((SetFieldCase) actionClass).getSetField().getVlanMatch() != null) {
int vlanVid = ((SetFieldCase) actionClass).getSetField().getVlanMatch().getVlanId()
- .getVlanId().getValue();
+ .getVlanId().getValue().toJava();
listActionInfo.add(new ActionSetFieldVlanVid(pos++, vlanVid));
}
} else if (actionClass instanceof NxActionResubmitRpcAddGroupCase) {
- Short tableId = ((NxActionResubmitRpcAddGroupCase) actionClass).getNxResubmit().getTable();
+ Short tableId = ((NxActionResubmitRpcAddGroupCase) actionClass).getNxResubmit().getTable().toJava();
listActionInfo.add(new ActionNxResubmit(pos++, tableId));
} else if (actionClass instanceof NxActionRegLoadNodesNodeTableFlowApplyActionsCase) {
NxRegLoad nxRegLoad =
((NxActionRegLoadNodesNodeTableFlowApplyActionsCase) actionClass).getNxRegLoad();
- listActionInfo.add(new ActionRegLoad(pos++, NxmNxReg6.class, nxRegLoad.getDst().getStart(),
- nxRegLoad.getDst().getEnd(), nxRegLoad.getValue().longValue()));
+ listActionInfo.add(new ActionRegLoad(pos++, NxmNxReg6.class, nxRegLoad.getDst().getStart().toJava(),
+ nxRegLoad.getDst().getEnd().toJava(), nxRegLoad.getValue().longValue()));
}
}
return listActionInfo;
return IpPrefixBuilder.getDefaultInstance(prefix).getIpv6Prefix() != null;
}
- static InstanceIdentifier<DpnRoutersList> getDpnRoutersId(BigInteger dpnId) {
+ static InstanceIdentifier<DpnRoutersList> getDpnRoutersId(Uint64 dpnId) {
return InstanceIdentifier.builder(DpnRouters.class)
.child(DpnRoutersList.class, new DpnRoutersListKey(dpnId)).build();
}
- static InstanceIdentifier<DpnVpninterfacesList> getRouterDpnId(String routerName, BigInteger dpnId) {
+ static InstanceIdentifier<DpnVpninterfacesList> getRouterDpnId(String routerName, Uint64 dpnId) {
return InstanceIdentifier.builder(NeutronRouterDpns.class)
.child(RouterDpnList.class, new RouterDpnListKey(routerName))
.child(DpnVpninterfacesList.class, new DpnVpninterfacesListKey(dpnId)).build();
}
}
- static void createRouterIdsConfigDS(DataBroker dataBroker, long routerId, String routerName) {
+ static void createRouterIdsConfigDS(DataBroker dataBroker, Uint32 routerId, String routerName) {
if (routerId == NatConstants.INVALID_ID) {
LOG.error("createRouterIdsConfigDS : invalid routerId for routerName {}", routerName);
return;
}
@Nullable
- static FlowEntity buildDefaultNATFlowEntityForExternalSubnet(BigInteger dpId, long vpnId, String subnetId,
+ static FlowEntity buildDefaultNATFlowEntityForExternalSubnet(Uint64 dpId, Uint32 vpnId, String subnetId,
IdManagerService idManager) {
InetAddress defaultIP = null;
try {
List<MatchInfo> matches = new ArrayList<>();
matches.add(MatchEthernetType.IPV4);
//add match for vrfid
- matches.add(new MatchMetadata(MetaDataUtil.getVpnIdMetadata(vpnId), MetaDataUtil.METADATA_MASK_VRFID));
+ matches.add(new MatchMetadata(MetaDataUtil.getVpnIdMetadata(vpnId.longValue()),
+ MetaDataUtil.METADATA_MASK_VRFID));
List<InstructionInfo> instructions = new ArrayList<>();
List<ActionInfo> actionsInfo = new ArrayList<>();
- long groupId = getUniqueId(idManager, NatConstants.SNAT_IDPOOL_NAME, NatUtil.getGroupIdKey(subnetId));
+ Uint32 groupId = getUniqueId(idManager, NatConstants.SNAT_IDPOOL_NAME, NatUtil.getGroupIdKey(subnetId));
if (groupId == NatConstants.INVALID_ID) {
LOG.error("Unable to get groupId for subnet {} while building defauly flow entity", subnetId);
return null;
}
- actionsInfo.add(new ActionGroup(groupId));
+ actionsInfo.add(new ActionGroup(groupId.longValue()));
String flowRef = getFlowRef(dpId, NwConstants.L3_FIB_TABLE, defaultIP, vpnId);
instructions.add(new InstructionApplyActions(actionsInfo));
return MDSALUtil.buildFlowEntity(dpId, NwConstants.L3_FIB_TABLE, flowRef,
}
@Nullable
- static String getExtGwMacAddFromRouterId(DataBroker broker, long routerId) {
+ static String getExtGwMacAddFromRouterId(DataBroker broker, Uint32 routerId) {
String routerName = getRouterName(broker, routerId);
if (routerName == null) {
LOG.error("getExtGwMacAddFromRouterId : empty routerName received");
}
}
- protected static long getExternalSubnetVpnId(DataBroker dataBroker, Uuid subnetId) {
+ protected static Uint32 getExternalSubnetVpnId(DataBroker dataBroker, Uuid subnetId) {
Optional<org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.external
.subnets.Subnets> optionalExternalSubnets = NatUtil.getOptionalExternalSubnets(dataBroker,
subnetId);
return NatConstants.INVALID_ID;
}
- protected static long getExternalSubnetVpnId(TypedReadTransaction<Configuration> tx, Uuid subnetId) {
+ protected static Uint32 getExternalSubnetVpnId(TypedReadTransaction<Configuration> tx, Uuid subnetId) {
Optional<org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.external
.subnets.Subnets> optionalExternalSubnets = NatUtil.getOptionalExternalSubnets(tx,
subnetId);
return NatConstants.INVALID_ID;
}
- protected static long getExternalSubnetVpnIdForRouterExternalIp(DataBroker dataBroker, String externalIpAddress,
+ protected static Uint32 getExternalSubnetVpnIdForRouterExternalIp(DataBroker dataBroker, String externalIpAddress,
Routers router) {
Uuid externalSubnetId = NatUtil.getExternalSubnetForRouterExternalIp(externalIpAddress, router);
if (externalSubnetId != null) {
.child(ElanInstance.class, new ElanInstanceKey(elanInstanceName)).build();
}
- public static long getTunnelIdForNonNaptToNaptFlow(DataBroker dataBroker, NatOverVxlanUtil natOverVxlanUtil,
+ public static Uint64 getTunnelIdForNonNaptToNaptFlow(DataBroker dataBroker, NatOverVxlanUtil natOverVxlanUtil,
IElanService elanManager, IdManagerService idManager,
- long routerId, String routerName) {
+ Uint32 routerId, String routerName) {
if (elanManager.isOpenStackVniSemanticsEnforced()) {
// Router VNI will be set as tun_id if OpenStackSemantics is enabled
- return natOverVxlanUtil.getRouterVni(routerName, routerId).longValue();
+ return natOverVxlanUtil.getRouterVni(routerName, routerId);
} else {
return NatEvpnUtil.getTunnelIdForRouter(idManager, dataBroker, routerName, routerId);
}
}
- public static void makePreDnatToSnatTableEntry(IMdsalApiManager mdsalManager, BigInteger naptDpnId,
+ public static void makePreDnatToSnatTableEntry(IMdsalApiManager mdsalManager, Uint64 naptDpnId,
short tableId, TypedWriteTransaction<Configuration> confTx) {
LOG.debug("makePreDnatToSnatTableEntry : Create Pre-DNAT table {} --> table {} flow on NAPT DpnId {} ",
NwConstants.PDNAT_TABLE, tableId, naptDpnId);
}
public static void removePreDnatToSnatTableEntry(TypedReadWriteTransaction<Configuration> confTx,
- IMdsalApiManager mdsalManager, BigInteger naptDpnId) throws ExecutionException, InterruptedException {
+ IMdsalApiManager mdsalManager, Uint64 naptDpnId) throws ExecutionException, InterruptedException {
LOG.debug("removePreDnatToSnatTableEntry : Remove Pre-DNAT table {} --> table {} flow on NAPT DpnId {} ",
NwConstants.PDNAT_TABLE, NwConstants.INBOUND_NAPT_TABLE, naptDpnId);
String flowRef = getFlowRefPreDnatToSnat(naptDpnId, NwConstants.PDNAT_TABLE, "PreDNATToSNAT");
flowRef, naptDpnId);
}
- private static String getFlowRefPreDnatToSnat(BigInteger dpnId, short tableId, String uniqueId) {
+ private static String getFlowRefPreDnatToSnat(Uint64 dpnId, short tableId, String uniqueId) {
return NatConstants.NAPT_FLOWID_PREFIX + dpnId + NwConstants.FLOWID_SEPARATOR + tableId
+ NwConstants.FLOWID_SEPARATOR + uniqueId;
}
- public static boolean isFloatingIpPresentForDpn(DataBroker dataBroker, BigInteger dpnId, String rd,
+ public static boolean isFloatingIpPresentForDpn(DataBroker dataBroker, Uint64 dpnId, String rd,
String vpnName, String externalIp,
Boolean isMoreThanOneFipCheckOnDpn) {
InstanceIdentifier<VpnToDpnList> id = getVpnToDpnListIdentifier(rd, dpnId);
return false;
}
- private static InstanceIdentifier<VpnToDpnList> getVpnToDpnListIdentifier(String rd, BigInteger dpnId) {
+ private static InstanceIdentifier<VpnToDpnList> getVpnToDpnListIdentifier(String rd, Uint64 dpnId) {
return InstanceIdentifier.builder(VpnInstanceOpData.class)
.child(VpnInstanceOpDataEntry.class, new VpnInstanceOpDataEntryKey(rd))
.child(VpnToDpnList.class, new VpnToDpnListKey(dpnId)).build();
}
public static boolean checkForRoutersWithSameExtNetAndNaptSwitch(DataBroker broker, Uuid networkId,
- String routerName, BigInteger dpnId) {
+ String routerName, Uint64 dpnId) {
InstanceIdentifier<Networks> id = buildNetworkIdentifier(networkId);
Optional<Networks> networkData = MDSALUtil.read(broker, LogicalDatastoreType.CONFIGURATION, id);
for (Uuid routerUuid : routerUuidList) {
String sharedRouterName = routerUuid.getValue();
if (!routerName.equals(sharedRouterName)) {
- BigInteger switchDpnId = NatUtil.getPrimaryNaptfromRouterName(broker, sharedRouterName);
+ Uint64 switchDpnId = NatUtil.getPrimaryNaptfromRouterName(broker, sharedRouterName);
if (switchDpnId != null && switchDpnId.equals(dpnId)) {
LOG.debug("checkForRoutersWithSameExtNetAndNaptSwitch: external-network {} is "
+ "associated with other active router {} on NAPT switch {}", networkId,
}
public static boolean checkForRoutersWithSameExtSubnetAndNaptSwitch(DataBroker broker, Uuid externalSubnetId,
- String routerName, BigInteger dpnId) {
+ String routerName, Uint64 dpnId) {
List<Uuid> routerUuidList = getOptionalExternalSubnets(broker, externalSubnetId).toJavaUtil()
.map(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.external
.subnets.Subnets::getRouterIds).orElse(emptyList());
for (Uuid routerUuid : routerUuidList) {
String sharedRouterName = routerUuid.getValue();
if (!routerName.equals(sharedRouterName)) {
- BigInteger switchDpnId = NatUtil.getPrimaryNaptfromRouterName(broker, sharedRouterName);
+ Uint64 switchDpnId = NatUtil.getPrimaryNaptfromRouterName(broker, sharedRouterName);
if (switchDpnId != null && switchDpnId.equals(dpnId)) {
LOG.debug("checkForRoutersWithSameExtSubnetAndNaptSwitch: external-subnetwork {} is "
+ "associated with other active router {} on NAPT switch {}", externalSubnetId,
}
public static void installRouterGwFlows(ManagedNewTransactionRunner txRunner, IVpnManager vpnManager,
- Routers router, BigInteger primarySwitchId, int addOrRemove) {
+ Routers router, Uint64 primarySwitchId, int addOrRemove) {
ListenableFutures.addErrorLogging(txRunner.callWithNewReadWriteTransactionAndSubmit(CONFIGURATION, tx -> {
List<ExternalIps> externalIps = router.getExternalIps();
List<String> externalIpsSting = new ArrayList<>();
@SuppressWarnings("checkstyle:IllegalCatch")
public static void handleSNATForDPN(DataBroker dataBroker, IMdsalApiManager mdsalManager,
IdManagerService idManager, NaptSwitchHA naptSwitchHA,
- BigInteger dpnId, Routers extRouters, long routerId, Long routerVpnId,
+ Uint64 dpnId, Routers extRouters, Uint32 routerId, Uint32 routerVpnId,
TypedReadWriteTransaction<Configuration> confTx,
ProviderTypes extNwProvType, UpgradeState upgradeState) {
//Check if primary and secondary switch are selected, If not select the role
//Install select group to NAPT switch
//Install default miss entry to NAPT switch
- BigInteger naptSwitch;
+ Uint64 naptSwitch;
String routerName = extRouters.getRouterName();
Boolean upgradeInProgress = false;
if (upgradeState != null) {
upgradeInProgress = upgradeState.isUpgradeInProgress();
}
- BigInteger naptId = NatUtil.getPrimaryNaptfromRouterName(dataBroker, routerName);
- if (naptId == null || naptId.equals(BigInteger.ZERO)
+ Uint64 naptId = NatUtil.getPrimaryNaptfromRouterName(dataBroker, routerName);
+ if (naptId == null || naptId.equals(Uint64.ZERO)
|| (!NatUtil.getSwitchStatus(dataBroker, naptId) && (upgradeInProgress == false))) {
LOG.debug("handleSNATForDPN : NaptSwitch is down or not selected for router {},naptId {}",
routerName, naptId);
LOG.debug("handleSNATForDPN : Successfully installed flow for dpnId {} router {}", dpnId, routerName);
mdsalManager.addFlow(confTx, flowEntity);
//Removing primary flows from old napt switch
- if (naptId != null && !naptId.equals(BigInteger.ZERO)) {
+ if (naptId != null && !naptId.equals(Uint64.ZERO)) {
LOG.debug("handleSNATForDPN : Removing primary flows from old napt switch {} for router {}",
naptId, routerName);
try {
naptSwitchHA.installSnatGroupEntry(dpnId, bucketInfo, routerName);
// Install miss entry (table 26) pointing to group
- long groupId = NatUtil.getUniqueId(idManager, NatConstants.SNAT_IDPOOL_NAME,
+ Uint32 groupId = NatUtil.getUniqueId(idManager, NatConstants.SNAT_IDPOOL_NAME,
NatUtil.getGroupIdKey(routerName));
if (groupId != NatConstants.INVALID_ID) {
FlowEntity flowEntity =
- naptSwitchHA.buildSnatFlowEntity(dpnId, routerName, groupId,
+ naptSwitchHA.buildSnatFlowEntity(dpnId, routerName, groupId.longValue(),
routerVpnId, NatConstants.ADD_FLOW);
if (flowEntity == null) {
LOG.error("handleSNATForDPN : Failed to populate flowentity for router {} with dpnId {}"
@SuppressWarnings("checkstyle:IllegalCatch")
public static void removeSNATFromDPN(DataBroker dataBroker, IMdsalApiManager mdsalManager,
- IdManagerService idManager, NaptSwitchHA naptSwitchHA, BigInteger dpnId,
- String routerName, long routerId, long routerVpnId, Uuid extNetworkId,
+ IdManagerService idManager, NaptSwitchHA naptSwitchHA, Uint64 dpnId,
+ String routerName, Uint32 routerId, Uint32 routerVpnId, Uuid extNetworkId,
ProviderTypes extNwProvType, TypedReadWriteTransaction<Configuration> confTx)
throws ExecutionException, InterruptedException {
//irrespective of naptswitch or non-naptswitch, SNAT default miss entry need to be removed
return;
}
//Get the external IP labels other than VXLAN provider type. Since label is not applicable for VXLAN
- Map<String, Long> externalIpLabel;
+ Map<String, Uint32> externalIpLabel;
if (extNwProvType == ProviderTypes.VXLAN) {
externalIpLabel = null;
} else {
externalIpLabel = NatUtil.getExternalIpsLabelForRouter(dataBroker, routerId);
}
- BigInteger naptSwitch = NatUtil.getPrimaryNaptfromRouterName(dataBroker, routerName);
- if (naptSwitch == null || naptSwitch.equals(BigInteger.ZERO)) {
+ Uint64 naptSwitch = NatUtil.getPrimaryNaptfromRouterName(dataBroker, routerName);
+ if (naptSwitch == null || naptSwitch.equals(Uint64.ZERO)) {
LOG.error("removeSNATFromDPN : No naptSwitch is selected for router {}", routerName);
return;
}
if (!naptStatus) {
LOG.debug("removeSNATFromDPN: Switch with DpnId {} is not naptSwitch for router {}",
dpnId, routerName);
- long groupId = getUniqueId(idManager, NatConstants.SNAT_IDPOOL_NAME, NatUtil.getGroupIdKey(routerName));
+ Uint32 groupId = getUniqueId(idManager, NatConstants.SNAT_IDPOOL_NAME, NatUtil.getGroupIdKey(routerName));
FlowEntity flowEntity = null;
try {
if (groupId != NatConstants.INVALID_ID) {
flowEntity = naptSwitchHA
- .buildSnatFlowEntity(dpnId, routerName, groupId, routerVpnId,
+ .buildSnatFlowEntity(dpnId, routerName, groupId.longValue(), routerVpnId,
NatConstants.DEL_FLOW);
if (flowEntity == null) {
LOG.error("removeSNATFromDPN : Failed to populate flowentity for router:{} "
GroupEntity groupEntity = null;
try {
if (groupId != NatConstants.INVALID_ID) {
- groupEntity = MDSALUtil.buildGroupEntity(dpnId, groupId, routerName,
+ groupEntity = MDSALUtil.buildGroupEntity(dpnId, groupId.longValue(), routerName,
GroupTypes.GroupAll, emptyList() /*listBucketInfo*/);
LOG.info("removeSNATFromDPN : Removing NAPT GroupEntity:{}", groupEntity);
mdsalManager.removeGroup(groupEntity);
}
public static void addPseudoPortToElanDpn(String elanInstanceName, String pseudoPortId,
- BigInteger dpnId, DataBroker dataBroker) {
+ Uint64 dpnId, DataBroker dataBroker) {
InstanceIdentifier<DpnInterfaces> elanDpnInterfaceId = getElanDpnInterfaceOperationalDataPath(
elanInstanceName, dpnId);
// FIXME: separate this out?
}
public static void removePseudoPortFromElanDpn(String elanInstanceName, String pseudoPortId,
- BigInteger dpnId, DataBroker dataBroker) {
+ Uint64 dpnId, DataBroker dataBroker) {
InstanceIdentifier<DpnInterfaces> elanDpnInterfaceId = getElanDpnInterfaceOperationalDataPath(
elanInstanceName, dpnId);
// FIXME: separate this out?
}
public static InstanceIdentifier<DpnInterfaces> getElanDpnInterfaceOperationalDataPath(String elanInstanceName,
- BigInteger dpId) {
+ Uint64 dpId) {
return InstanceIdentifier.builder(ElanDpnInterfaces.class)
.child(ElanDpnInterfacesList.class, new ElanDpnInterfacesListKey(elanInstanceName))
.child(DpnInterfaces.class, new DpnInterfacesKey(dpId)).build();
}
- public static InstanceIdentifier<Group> getGroupInstanceId(BigInteger dpnId, long groupId) {
+ public static InstanceIdentifier<Group> getGroupInstanceId(Uint64 dpnId, Uint32 groupId) {
return InstanceIdentifier.builder(Nodes.class).child(org.opendaylight.yang.gen.v1.urn.opendaylight
.inventory.rev130819.nodes.Node.class, new NodeKey(new NodeId("openflow:" + dpnId)))
.augmentation(FlowCapableNode.class).child(Group.class, new GroupKey(new GroupId(groupId))).build();
}
}
- public static boolean getSwitchStatus(DataBroker broker, BigInteger switchId) {
+ public static boolean getSwitchStatus(DataBroker broker, Uint64 switchId) {
NodeId nodeId = new NodeId("openflow:" + switchId);
LOG.debug("getSwitchStatus : Querying switch with dpnId {} is up/down", nodeId);
InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node> nodeInstanceId
}
- public static Map<String, String> getOpenvswitchOtherConfigMap(BigInteger dpnId, DataBroker dataBroker) {
+ public static Map<String, String> getOpenvswitchOtherConfigMap(Uint64 dpnId, DataBroker dataBroker) {
String otherConfigVal = getProviderMappings(dpnId, dataBroker);
return getMultiValueMap(otherConfigVal);
}
return valueMap;
}
- public static Optional<Node> getBridgeRefInfo(BigInteger dpnId, DataBroker dataBroker) {
+ public static Optional<Node> getBridgeRefInfo(Uint64 dpnId, DataBroker dataBroker) {
InstanceIdentifier<BridgeRefEntry> bridgeRefInfoPath = InstanceIdentifier.create(BridgeRefInfo.class)
.child(BridgeRefEntry.class, new BridgeRefEntryKey(dpnId));
}
@Nullable
- public static String getProviderMappings(BigInteger dpId, DataBroker dataBroker) {
+ public static String getProviderMappings(Uint64 dpId, DataBroker dataBroker) {
return getBridgeRefInfo(dpId, dataBroker).toJavaUtil().map(node -> getOpenvswitchOtherConfigs(node,
PROVIDER_MAPPINGS, dataBroker)).orElse(null);
}
return node.augmentation(OvsdbBridgeAugmentation.class);
}
- public static String getDefaultFibRouteToSNATForSubnetJobKey(String subnetName, BigInteger dpnId) {
+ public static String getDefaultFibRouteToSNATForSubnetJobKey(String subnetName, Uint64 dpnId) {
return NatConstants.NAT_DJC_PREFIX + subnetName + dpnId;
}
}
public static void addFlow(TypedWriteTransaction<Configuration> confTx, IMdsalApiManager mdsalManager,
- BigInteger dpId, short tableId, String flowId, int priority, String flowName, BigInteger cookie,
+ Uint64 dpId, short tableId, String flowId, int priority, String flowName, Uint64 cookie,
List<? extends MatchInfoBase> matches, List<InstructionInfo> instructions) {
FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpId, tableId, flowId, priority, flowName,
NatConstants.DEFAULT_IDLE_TIMEOUT, NatConstants.DEFAULT_IDLE_TIMEOUT, cookie, matches,
}
public static void removeFlow(TypedReadWriteTransaction<Configuration> confTx, IMdsalApiManager mdsalManager,
- BigInteger dpId, short tableId, String flowId) throws ExecutionException, InterruptedException {
+ Uint64 dpId, short tableId, String flowId) throws ExecutionException, InterruptedException {
LOG.trace("syncFlow : Removing Acl Flow DpnId {}, flowId {}", dpId, flowId);
mdsalManager.removeFlow(confTx, dpId, flowId, tableId);
}
- public static String getIpv6FlowRef(BigInteger dpnId, short tableId, long routerID) {
+ public static String getIpv6FlowRef(Uint64 dpnId, short tableId, Uint32 routerID) {
return new StringBuilder().append(NatConstants.IPV6_FLOWID_PREFIX).append(dpnId).append(NatConstants
.FLOWID_SEPARATOR).append(tableId).append(NatConstants.FLOWID_SEPARATOR).append(routerID).toString();
}
- public static String getTunnelInterfaceName(BigInteger srcDpId, BigInteger dstDpId,
+ public static String getTunnelInterfaceName(Uint64 srcDpId, Uint64 dstDpId,
ItmRpcService itmManager) {
Class<? extends TunnelTypeBase> tunType = TunnelTypeVxlan.class;
RpcResult<GetTunnelInterfaceNameOutput> rpcResult;
return portsOptional.get();
}
- static ReentrantLock lockForNat(final BigInteger dataPath) {
+ static ReentrantLock lockForNat(final Uint64 dataPath) {
// FIXME: wrap this in an Identifier
return JvmGlobalLocks.getLockForString(NatConstants.NAT_DJC_PREFIX + dataPath);
}
public static void removeSnatEntriesForPort(DataBroker dataBroker, NaptManager naptManager,
IMdsalApiManager mdsalManager, NeutronvpnService neutronVpnService,
String interfaceName, String routerName) {
- Long routerId = NatUtil.getVpnId(dataBroker, routerName);
+ Uint32 routerId = NatUtil.getVpnId(dataBroker, routerName);
if (routerId == NatConstants.INVALID_ID) {
LOG.error("removeSnatEntriesForPort: routerId not found for routername {}", routerName);
return;
}
- BigInteger naptSwitch = getPrimaryNaptfromRouterName(dataBroker, routerName);
- if (naptSwitch == null || naptSwitch.equals(BigInteger.ZERO)) {
+ Uint64 naptSwitch = getPrimaryNaptfromRouterName(dataBroker, routerName);
+ if (naptSwitch == null || naptSwitch.equals(Uint64.ZERO)) {
LOG.error("removeSnatEntriesForPort: NaptSwitch is not elected for router {}"
+ "with Id {}", routerName, routerId);
return;
LOG.debug("removeSnatEntriesForPort: Internal Ip retrieved for interface {} is {} in router with Id {}",
interfaceName, internalIp, routerId);
for (ProtocolTypes protocol : protocolTypesList) {
- List<Integer> portList = NatUtil.getInternalIpPortListInfo(dataBroker, routerId, internalIp, protocol);
+ List<Uint16> portList = NatUtil.getInternalIpPortListInfo(dataBroker, routerId, internalIp, protocol);
if (portList != null) {
- for (Integer portnum : portList) {
+ for (Uint16 portnum : portList) {
//build and remove the flow in outbound table
removeNatFlow(mdsalManager, naptSwitch, NwConstants.OUTBOUND_NAPT_TABLE,
- routerId, internalIp, portnum, protocol.getName());
+ routerId, internalIp, portnum.toJava(), protocol.getName());
//build and remove the flow in inboundtable
removeNatFlow(mdsalManager, naptSwitch, NwConstants.INBOUND_NAPT_TABLE, routerId,
- internalIp, portnum, protocol.getName());
+ internalIp, portnum.toJava(), protocol.getName());
//Get the external IP address and the port from the model
NAPTEntryEvent.Protocol proto = protocol.toString().equals(ProtocolTypes.TCP.toString())
? NAPTEntryEvent.Protocol.TCP : NAPTEntryEvent.Protocol.UDP;
IpPortExternal ipPortExternal = NatUtil.getExternalIpPortMap(dataBroker, routerId,
- internalIp, String.valueOf(portnum), proto);
+ internalIp, String.valueOf(portnum.toJava()), proto);
if (ipPortExternal == null) {
LOG.error("removeSnatEntriesForPort: Mapping for internalIp {} "
+ "with port {} is not found in "
return;
}
String externalIpAddress = ipPortExternal.getIpAddress();
- String internalIpPort = internalIp + ":" + portnum;
+ String internalIpPort = internalIp + ":" + portnum.toJava();
// delete the entry from IntExtIpPortMap DS
naptManager.removeFromIpPortMapDS(routerId, internalIpPort, proto);
return protocollist;
}
- private static void removeNatFlow(IMdsalApiManager mdsalManager, BigInteger dpnId, short tableId, Long routerId,
+ private static void removeNatFlow(IMdsalApiManager mdsalManager, Uint64 dpnId, short tableId, Uint32 routerId,
String ipAddress, int ipPort, String protocol) {
String switchFlowRef = NatUtil.getNaptFlowRef(dpnId, tableId, String.valueOf(routerId), ipAddress, ipPort,
String dpnKey = key.getId().getValue();
String dpnID = null;
if (dpnKey.contains(NatConstants.COLON_SEPARATOR)) {
- dpnID = new BigInteger(dpnKey.split(NatConstants.COLON_SEPARATOR)[1]).toString();
+ dpnID = Uint64.valueOf(dpnKey.split(NatConstants.COLON_SEPARATOR)[1]).toString();
}
return dpnID;
}