flowMatches.addAll(AclServiceUtils.buildIpAndDstServiceMatch(aclTag, aap));
List<InstructionInfo> instructions = AclServiceOFFlowBuilder.getGotoInstructionInfo(getAclCommitterTable());
- String flowNameAdded = "Acl_Filter_Egress_" + String.valueOf(aap.getIpAddress().getValue()) + "_" + aclTag;
+ String flowNameAdded = "Acl_Filter_Egress_" + aap.getIpAddress().stringValue() + "_" + aclTag;
syncFlow(dpId, getAclRemoteAclTable(), flowNameAdded, AclConstants.ACL_DEFAULT_PRIORITY, "ACL", 0, 0,
AclConstants.COOKIE_ACL_BASE, flowMatches, instructions, addOrRemove);
gotoInstructions.add(new InstructionGotoTable(getAclConntrackClassifierTable()));
String flowName = "Egress_Fixed_Goto_Classifier_" + dpId + "_" + lportTag + "_" + mac.getValue() + "_"
- + String.valueOf(attachIp.getValue());
+ + attachIp.stringValue();
syncFlow(dpId, getAclAntiSpoofingTable(), flowName, AclConstants.PROTO_MATCH_PRIORITY, "ACL", 0, 0,
AclConstants.COOKIE_ACL_BASE, matches, gotoInstructions, addOrRemove);
}
LOG.debug("{} ARP Rule on DPID {}, lportTag {}",
addOrRemove == NwConstants.DEL_FLOW ? "Deleting" : "Adding", dpId, lportTag);
String flowName = "Egress_ARP_" + dpId + "_" + lportTag + "_" + allowedAddress.getMacAddress().getValue()
- + String.valueOf(allowedAddressIp.getValue());
+ + allowedAddressIp.stringValue();
syncFlow(dpId, getAclAntiSpoofingTable(), flowName, AclConstants.PROTO_ARP_TRAFFIC_MATCH_PRIORITY, "ACL", 0,
0, AclConstants.COOKIE_ACL_BASE, matches, instructions, addOrRemove);
}
import org.opendaylight.netvirt.aclservice.utils.AclDataUtil;
import org.opendaylight.netvirt.aclservice.utils.AclServiceOFFlowBuilder;
import org.opendaylight.netvirt.aclservice.utils.AclServiceUtils;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefixBuilder;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.ServiceModeEgress;
gotoInstructions.add(new InstructionGotoTable(getAclConntrackClassifierTable()));
String flowName = "Ingress_Fixed_Goto_Classifier_" + dpId + "_" + lportTag + "_" + mac.getValue() + "_"
- + String.valueOf(attachIp.getValue());
+ + attachIp.stringValue();
syncFlow(dpId, getAclAntiSpoofingTable(), flowName, AclConstants.PROTO_MATCH_PRIORITY, "ACL", 0, 0,
AclConstants.COOKIE_ACL_BASE, matches, gotoInstructions, addOrRemove);
}
flowMatches.addAll(AclServiceUtils.buildIpAndSrcServiceMatch(aclTag, aap));
List<InstructionInfo> instructions = AclServiceOFFlowBuilder.getGotoInstructionInfo(getAclCommitterTable());
- String flowNameAdded = "Acl_Filter_Ingress_" + String.valueOf(aap.getIpAddress().getValue()) + "_" + aclTag;
+ String flowNameAdded = "Acl_Filter_Ingress_" + aap.getIpAddress().stringValue() + "_" + aclTag;
syncFlow(dpId, getAclRemoteAclTable(), flowNameAdded, AclConstants.ACL_DEFAULT_PRIORITY, "ACL", 0, 0,
AclConstants.COOKIE_ACL_BASE, flowMatches, instructions, addOrRemove);
AclServiceUtils.buildIcmpV6Matches(AclConstants.ICMPV6_TYPE_RA, 0,
port.getLPortTag(), serviceMode);
matches.addAll(AclServiceUtils.buildIpMatches(
- new IpPrefixOrAddress(new IpPrefix(AclConstants.IPV6_LINK_LOCAL_PREFIX.toCharArray())),
+ new IpPrefixOrAddress(IpPrefixBuilder.getDefaultInstance(AclConstants.IPV6_LINK_LOCAL_PREFIX)),
AclServiceManager.MatchCriteria.MATCH_SOURCE));
String flowName = "Ingress_ICMPv6" + "_" + port.getDpId() + "_" + port.getLPortTag() + "_"
+ AclConstants.ICMPV6_TYPE_RA + "_LinkLocal_Permit_";
import javax.annotation.Nullable;
import javax.inject.Inject;
import javax.inject.Singleton;
-
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.aclservice.rev160608.DirectionBase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.aclservice.rev160608.InterfaceAcl;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.aclservice.rev160608.IpPrefixOrAddress;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.aclservice.rev160608.IpPrefixOrAddressBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.aclservice.rev160608.IpVersionV6;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.aclservice.rev160608.PortSubnets;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.aclservice.rev160608.SecurityRuleAttr;
public static List<MatchInfoBase> buildBroadcastIpV4Matches(String ipAddr) {
List<MatchInfoBase> matches = new ArrayList<>(2);
matches.add(new MatchEthernetDestination(new MacAddress(AclConstants.BROADCAST_MAC)));
- matches.addAll(AclServiceUtils.buildIpMatches(new IpPrefixOrAddress(ipAddr.toCharArray()),
+ matches.addAll(AclServiceUtils.buildIpMatches(IpPrefixOrAddressBuilder.getDefaultInstance(ipAddr),
MatchCriteria.MATCH_DESTINATION));
return matches;
}
}
private static String getAapFlowId(AllowedAddressPairs aap) {
- return aap.getMacAddress().getValue() + "_" + String.valueOf(aap.getIpAddress().getValue());
+ return aap.getMacAddress().getValue() + "_" + aap.getIpAddress().stringValue();
}
public static Long getElanIdFromInterface(String elanInterfaceName,DataBroker broker) {
IpPrefix ipPrefix = ipPrefixOrAddress.getIpPrefix();
if (ipPrefix != null) {
- addr = String.valueOf(ipPrefix.getValue()).split("/")[0];
+ addr = ipPrefix.stringValue().split("/")[0];
} else {
IpAddress ipAddress = ipPrefixOrAddress.getIpAddress();
if (ipAddress == null) {
LOG.error("Invalid address : {}", ipPrefixOrAddress);
return null;
} else {
- addr = String.valueOf(ipAddress.getValue());
+ addr = ipAddress.stringValue();
}
}
try {
import java.util.List;
import java.util.stream.Collectors;
import javax.inject.Inject;
-
import org.eclipse.xtext.xbase.lib.Pair;
import org.junit.Before;
import org.junit.Rule;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160218.access.lists.acl.access.list.entries.ace.MatchesBuilder;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160218.access.lists.acl.access.list.entries.ace.matches.ace.type.AceIpBuilder;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160218.access.lists.acl.access.list.entries.ace.matches.ace.type.ace.ip.ace.ip.version.AceIpv4Builder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressBuilder;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefixBuilder;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.aclservice.rev160608.DirectionEgress;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.aclservice.rev160608.DirectionIngress;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.aclservice.rev160608.IpPrefixOrAddress;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.aclservice.rev160608.IpPrefixOrAddressBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.aclservice.rev160608.IpVersionBase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.aclservice.rev160608.IpVersionV4;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.aclservice.rev160608.interfaces._interface.AllowedAddressPairs;
protected static AllowedAddressPairs buildAap(String ipAddress, String macAddress) {
return new AllowedAddressPairsBuilder()
- .setIpAddress(new IpPrefixOrAddress(new IpPrefix(ipAddress.toCharArray())))
+ .setIpAddress(new IpPrefixOrAddress(IpPrefixBuilder.getDefaultInstance(ipAddress)))
.setMacAddress(new MacAddress(macAddress)).build();
}
protected static SubnetInfo buildSubnetInfo(Uuid subnetId, String ipPrefix,
Class<? extends IpVersionBase> ipVersion, String gwIp) {
return new SubnetInfoBuilder().withKey(new SubnetInfoKey(subnetId)).setIpVersion(ipVersion)
- .setIpPrefix(new IpPrefixOrAddress(ipPrefix.toCharArray()))
- .setGatewayIp(new IpAddress(gwIp.toCharArray())).build();
+ .setIpPrefix(IpPrefixOrAddressBuilder.getDefaultInstance(ipPrefix))
+ .setGatewayIp(IpAddressBuilder.getDefaultInstance(gwIp)).build();
}
protected void setUpData() throws Exception {
import java.util.List;
import org.junit.Test;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.aclservice.rev160608.IpPrefixOrAddress;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.aclservice.rev160608.IpPrefixOrAddressBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.aclservice.rev160608.interfaces._interface.AllowedAddressPairs;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.aclservice.rev160608.interfaces._interface.AllowedAddressPairsBuilder;
inputAAPs.clear();
}
- private void buildInputAAP(List<AllowedAddressPairs> inputAAPs, String addr) {
+ private static void buildInputAAP(List<AllowedAddressPairs> inputAAPs, String addr) {
inputAAPs.add(buildAAp(addr));
}
- private AllowedAddressPairs buildAAp(String addr) {
+ private static AllowedAddressPairs buildAAp(String addr) {
AllowedAddressPairsBuilder aapb = new AllowedAddressPairsBuilder();
- aapb.setIpAddress(new IpPrefixOrAddress(addr.toCharArray()));
+ aapb.setIpAddress(IpPrefixOrAddressBuilder.getDefaultInstance(addr));
aapb.setMacAddress(new MacAddress("AA:BB:CC:DD:EE:FF"));
return aapb.build();
}
import org.opendaylight.yang.gen.v1.urn.ericsson.params.xml.ns.yang.ebgp.rev150901.tcp.security.option.grouping.tcp.security.option.TcpMd5SignatureOption;
import org.opendaylight.yang.gen.v1.urn.ericsson.params.xml.ns.yang.ebgp.rev150901.tcp.security.option.grouping.tcp.security.option.TcpMd5SignatureOptionBuilder;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressBuilder;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.FibEntries;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.fibentries.VrfTables;
}
long asNum = asId.getLocalAs();
IpAddress routerId = asId.getRouterId();
- String rid = routerId == null ? "" : new String(routerId.getValue());
+ String rid = routerId == null ? "" : routerId.stringValue();
int stalepathTime = (int) getStalePathtime(RESTART_DEFAULT_GR, config.getAsId());
boolean announceFbit = true;
boolean replayDone = false;
}
public void startBgp(long as, String routerId, int spt, boolean fbit) {
- IpAddress rid = routerId == null ? null : new IpAddress(routerId.toCharArray());
+ IpAddress rid = routerId == null ? null : IpAddressBuilder.getDefaultInstance(routerId);
Long staleTime = (long) spt;
InstanceIdentifier.InstanceIdentifierBuilder<AsId> iib =
InstanceIdentifier.builder(Bgp.class).child(AsId.class);
InstanceIdentifier<Vrfs> iid = iib.build();
+ InstanceIdentifier.builder(Bgp.class).build()
+ .child(Multipath.class, new MultipathKey(adfBuilder.getAfi(), adfBuilder.getSafi()));
@SuppressWarnings("static-access")
- InstanceIdentifier<Bgp> iid6 = iid.builder(Bgp.class).build()
- .child(Multipath.class, new MultipathKey(adfBuilder.getAfi(), adfBuilder.getSafi())).create(Bgp.class);
+ InstanceIdentifier<Bgp> iid6 = InstanceIdentifier.create(Bgp.class);
InstanceIdentifierBuilder<Vrfs> iib3 = iid6.child(Vrfs.class, new VrfsKey(rd)).builder();
InstanceIdentifier<Vrfs> iidFinal = iib3.build();
import org.opendaylight.yang.gen.v1.urn.ericsson.params.xml.ns.yang.ebgp.rev150901.bgp.VrfsKey;
import org.opendaylight.yang.gen.v1.urn.ericsson.params.xml.ns.yang.ebgp.rev150901.bgp.vrfs.AddressFamiliesVrf;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.ElanInstances;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstance;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.instances.ElanInstanceKey;
}
private static InstanceIdentifier<ExternalTeps> getExternalTepsIdentifier(String elanInstanceName, String tepIp) {
- IpAddress tepAdress = tepIp == null ? null : new IpAddress(tepIp.toCharArray());
+ IpAddress tepAdress = tepIp == null ? null : IpAddressBuilder.getDefaultInstance(tepIp);
return InstanceIdentifier.builder(ElanInstances.class).child(ElanInstance.class,
new ElanInstanceKey(elanInstanceName)).child(ExternalTeps.class,
new ExternalTepsKey(tepAdress)).build();
IpAddress routerId = asId.getRouterId();
Long spt = asId.getStalepathTime();
Boolean afb = asId.isAnnounceFbit();
- String rid = routerId == null ? "<n/a>" : new String(routerId.getValue());
+ String rid = routerId == null ? "<n/a>" : routerId.stringValue();
//F-bit is always set to ON (hardcoded), in SDN even though the controller is down
//forwarding state shall be retained.
String bit = "ON";
String interfaceName = CoeUtils.buildInterfaceName(pods.getNetworkNS(), pods.getName());
List<ListenableFuture<Void>> futures = new ArrayList<>();
futures.add(txRunner.callWithNewReadWriteTransactionAndSubmit(CONFIGURATION, tx -> {
- String nodeIp = String.valueOf(pods.getHostIpAddress().getValue());
+ String nodeIp = pods.getHostIpAddress().stringValue();
ElanInstance elanInstance = CoeUtils.createElanInstanceForTheFirstPodInTheNetwork(
pods.getNetworkNS(), nodeIp, podInterface, tx);
LOG.info("interface creation for pod {}", interfaceName);
IpAddress ip = pod.getInterface().get(0).getIpAddress();
String ipValue = ip.getIpv4Address() != null ? ip.getIpv4Address().getValue() : ip.getIpv6Address().getValue();
String ipPrefix = ip.getIpv4Address() != null ? ipValue + "/32" : ipValue + "/128";
- String hostIp = new String(pod.getHostIpAddress().getValue());
+ String hostIp = pod.getHostIpAddress().stringValue();
UUID subnetId = UUID.nameUUIDFromBytes(hostIp.getBytes(StandardCharsets.UTF_8));
String gatewayIP = ipValue.replaceFirst("\\d+$", "1");
Adjacency vmAdj = new AdjacencyBuilder().withKey(new AdjacencyKey(ipPrefix)).setIpAddress(ipPrefix)
return elanInterface.getElanInstanceName();
}
- private String getPoolKeyIdByAllocationPool(String networkId, AllocationPool pool) {
- return "dhcpAllocationPool." + networkId + "." + String.valueOf(pool.getSubnet().getValue());
+ private static String getPoolKeyIdByAllocationPool(String networkId, AllocationPool pool) {
+ return "dhcpAllocationPool." + networkId + "." + pool.getSubnet().stringValue();
}
private long createIdAllocation(String groupIdKey, String idKey) {
if (clientIp != null && serverIp != null) {
List<HostRoutes> subnetHostRoutes = new ArrayList<>(subnet.getHostRoutes().size());
for (HostRoutes hostRoute : subnet.getHostRoutes()) {
- if (!String.valueOf(hostRoute.getNexthop().getValue()).equals(clientIp)) {
+ if (!hostRoute.getNexthop().stringValue().equals(clientIp)) {
subnetHostRoutes.add(hostRoute);
}
}
dhcpInfo.setClientIp(clientIp).setServerIp(serverIp)
- .setCidr(String.valueOf(subnet.getCidr().getValue())).setHostRoutes(subnetHostRoutes)
+ .setCidr(subnet.getCidr().stringValue()).setHostRoutes(subnetHostRoutes)
.setDnsServersIpAddrs(dnsServers);
}
}
return dhcpInfo;
}
- private DhcpInfo getApDhcpInfo(AllocationPool ap, IpAddress allocatedIp) {
+ private static DhcpInfo getApDhcpInfo(AllocationPool ap, IpAddress allocatedIp) {
DhcpInfo dhcpInfo = null;
- String clientIp = String.valueOf(allocatedIp.getValue());
- String serverIp = String.valueOf(ap.getGateway().getValue());
+ String clientIp = allocatedIp.stringValue();
+ String serverIp = ap.getGateway().stringValue();
List<IpAddress> dnsServers = ap.getDnsServers();
dhcpInfo = new DhcpInfo();
- dhcpInfo.setClientIp(clientIp).setServerIp(serverIp).setCidr(String.valueOf(ap.getSubnet().getValue()))
+ dhcpInfo.setClientIp(clientIp).setServerIp(serverIp).setCidr(ap.getSubnet().stringValue())
.setHostRoutes(Collections.emptyList()).setDnsServersIpAddrs(dnsServers).setGatewayIp(serverIp);
return dhcpInfo;
* Many other modules use/need similar methods. Should
* be refactored to a common NeutronUtils module. *
*/
- private String getIpv4Address(Port port) {
+ private static String getIpv4Address(Port port) {
for (FixedIps fixedIp : port.getFixedIps()) {
if (isIpv4Address(fixedIp.getIpAddress())) {
return null;
}
- private boolean isIpv4Address(IpAddress ip) {
+ private static boolean isIpv4Address(IpAddress ip) {
return ip != null && ip.getIpv4Address() != null;
}
return dhcpMgr.getNeutronPort(interfaceName);
}
- private DHCP getDhcpPktIn(Ethernet actualEthernetPacket) {
+ private static DHCP getDhcpPktIn(Ethernet actualEthernetPacket) {
Ethernet ethPkt = actualEthernetPacket;
if (ethPkt.getEtherType() == (short)NwConstants.ETHTYPE_802_1Q) {
ethPkt = (Ethernet)ethPkt.getPayload();
return rawPkt;
}
- private byte[] getServerMacAddress(String phyAddress) {
+ private static byte[] getServerMacAddress(String phyAddress) {
// Should we return ControllerMac instead?
return DHCPUtils.strMacAddrtoByteArray(phyAddress);
}
import org.opendaylight.netvirt.elanmanager.api.ElanHelper;
import org.opendaylight.netvirt.neutronvpn.api.utils.NeutronUtils;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressBuilder;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.InterfacesState;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid;
.map(x -> ipn >> x & 0xFF).boxed() //
.map(String::valueOf) //
.toArray(String[]::new);
- return new IpAddress(String.join(".", array).toCharArray());
+ return IpAddressBuilder.getDefaultInstance(String.join(".", array));
}
static IpAddress convertLongToIp(long ip) {
.map(x -> ip >> x & 0xFF).boxed() //
.map(String::valueOf) //
.toArray(String[]::new);
- return new IpAddress(String.join(".", array).toCharArray());
+ return IpAddressBuilder.getDefaultInstance(String.join(".", array));
}
static long convertIpToLong(IpAddress ipa) {
- String[] splitIp = String.valueOf(ipa.getValue()).split("\\.");
+ String[] splitIp = ipa.stringValue().split("\\.");
long result = 0;
for (String part : splitIp) {
result <<= 8;
import com.google.common.base.Preconditions;
import com.google.common.collect.Lists;
import com.google.common.util.concurrent.ListenableFuture;
-
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentLinkedQueue;
-
import javax.annotation.PostConstruct;
import javax.inject.Inject;
import javax.inject.Singleton;
-
import org.apache.commons.lang3.StringUtils;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction;
if (isVxlanNetworkOrVxlanSegment(elanInfo)) {
if (elanUtils.isOpenstackVniSemanticsEnforced()) {
elanUtils.removeTerminatingServiceAction(dpId,
- elanUtils.getVxlanSegmentationId(elanInfo).intValue());
+ ElanUtils.getVxlanSegmentationId(elanInfo).intValue());
}
unsetExternalTunnelTable(dpId, elanInfo);
}
List<Action> remoteListActionInfo = elanItmUtils.getInternalTunnelItmEgressAction(
dpnInterface.getDpId(), otherFes.getDpId(),
elanUtils.isOpenstackVniSemanticsEnforced()
- ? elanUtils.getVxlanSegmentationId(elanInfo) : elanTag);
+ ? ElanUtils.getVxlanSegmentationId(elanInfo) : elanTag);
if (!remoteListActionInfo.isEmpty()) {
remoteListBucketInfo.add(MDSALUtil.buildBucket(remoteListActionInfo, MDSALUtil
.GROUP_WEIGHT, bucketId, MDSALUtil.WATCH_PORT, MDSALUtil.WATCH_GROUP));
listMatchInfoBase = ElanUtils.getTunnelMatchesForServiceId((int) elanTag);
instructionInfos = getInstructionsForOutGroup(ElanUtils.getElanLocalBCGId(elanTag));
} else {
- serviceId = elanUtils.getVxlanSegmentationId(elanInfo);
+ serviceId = ElanUtils.getVxlanSegmentationId(elanInfo);
listMatchInfoBase = buildMatchesForVni(serviceId);
instructionInfos = getInstructionsIntOrExtTunnelTable(elanTag);
}
ElanL2GatewayUtils.checkIfPhyLocatorAlreadyExistsInRemoteMcastEntry(externalNodeId, remoteMcastMac,
dpnTepIp);
LOG.debug("phyLocAlreadyExists = {} for locator [{}] in remote mcast entry for elan [{}], nodeId [{}]",
- phyLocAlreadyExists, String.valueOf(dpnTepIp.getValue()), elanName, externalNodeId.getValue());
+ phyLocAlreadyExists, dpnTepIp.stringValue(), elanName, externalNodeId.getValue());
List<PhysAddress> staticMacs = elanL2GatewayUtils.getElanDpnMacsFromInterfaces(lstElanInterfaceNames);
if (phyLocAlreadyExists) {
boolean ipExists = ElanL2GatewayUtils.checkIfPhyLocatorAlreadyExistsInRemoteMcastEntry(this.nodeId,
remoteMcastMac, ip);
if (!ipExists) {
- LOG.trace("IP [{}] not found in RemoteMcastMacs for node [{}]", String.valueOf(ip.getValue()),
+ LOG.trace("IP [{}] not found in RemoteMcastMacs for node [{}]", ip.stringValue(),
this.nodeId.getValue());
return false;
}
if (isVxlanNetworkOrVxlanSegment(elanInfo)) {
listBucketInfo.addAll(getRemoteBCGroupTunnelBuckets(elanDpns, dpnId, bucketId,
elanUtils.isOpenstackVniSemanticsEnforced()
- ? elanUtils.getVxlanSegmentationId(elanInfo) : elanTag));
+ ? ElanUtils.getVxlanSegmentationId(elanInfo) : elanTag));
}
listBucketInfo.addAll(getRemoteBCGroupExternalPortBuckets(elanDpns, dpnInterfaces, dpnId,
getNextAvailableBucketId(listBucketInfo.size())));
continue;
}
List<Action> listActionInfo = elanItmUtils.buildTunnelItmEgressActions(interfaceName,
- elanUtils.getVxlanSegmentationId(elanInfo), false);
+ ElanUtils.getVxlanSegmentationId(elanInfo), false);
listBucketInfo.add(MDSALUtil.buildBucket(listActionInfo, MDSALUtil.GROUP_WEIGHT, bucketId,
MDSALUtil.WATCH_PORT, MDSALUtil.WATCH_GROUP));
bucketId++;
remoteTepIps.add(dhcpDesignatedSwitchTepIp);
HwvtepPhysicalLocatorAugmentation phyLocatorAug = HwvtepSouthboundUtils
- .createHwvtepPhysicalLocatorAugmentation(String.valueOf(dhcpDesignatedSwitchTepIp.getValue()));
+ .createHwvtepPhysicalLocatorAugmentation(dhcpDesignatedSwitchTepIp.stringValue());
InstanceIdentifier<TerminationPoint> iid =
HwvtepSouthboundUtils.createPhysicalLocatorInstanceIdentifier(nodeId, phyLocatorAug);
TerminationPoint terminationPoint = new TerminationPointBuilder()
iid, terminationPoint);
LOG.info("Adding PhysicalLocator for node: {} with Dhcp designated switch Tep Ip {} "
+ "as physical locator, elan {}", device.getHwvtepNodeId(),
- String.valueOf(dhcpDesignatedSwitchTepIp.getValue()), elanName);
+ dhcpDesignatedSwitchTepIp.stringValue(), elanName);
} else {
LOG.warn("Dhcp designated switch Tep Ip not found for l2 gw node {} and elan {}",
device.getHwvtepNodeId(), elanName);
List<LocatorSet> locators = new ArrayList<>();
for (IpAddress tepIp : tepIps) {
HwvtepPhysicalLocatorAugmentation phyLocatorAug = HwvtepSouthboundUtils
- .createHwvtepPhysicalLocatorAugmentation(String.valueOf(tepIp.getValue()));
+ .createHwvtepPhysicalLocatorAugmentation(tepIp.stringValue());
HwvtepPhysicalLocatorRef phyLocRef = new HwvtepPhysicalLocatorRef(
HwvtepSouthboundUtils.createPhysicalLocatorInstanceIdentifier(nodeId, phyLocatorAug));
locators.add(new LocatorSetBuilder().setLocatorRef(phyLocRef).build());
RemoteMcastMacs remoteMcastMac, IpAddress expectedPhyLocatorIp) {
if (remoteMcastMac != null) {
HwvtepPhysicalLocatorAugmentation expectedPhyLocatorAug = HwvtepSouthboundUtils
- .createHwvtepPhysicalLocatorAugmentation(String.valueOf(expectedPhyLocatorIp.getValue()));
+ .createHwvtepPhysicalLocatorAugmentation(expectedPhyLocatorIp.stringValue());
HwvtepPhysicalLocatorRef expectedPhyLocRef = new HwvtepPhysicalLocatorRef(
HwvtepSouthboundUtils.createPhysicalLocatorInstanceIdentifier(nodeId, expectedPhyLocatorAug));
if (remoteMcastMac.getLocatorSet() != null) {
if (!areMLAGDevices(l2GatewayDeviceToBeConfigured, otherDevice)) {
for (LocalUcastMacs localUcastMac : otherDevice.getUcastLocalMacs()) {
HwvtepPhysicalLocatorAugmentation physLocatorAug = HwvtepSouthboundUtils
- .createHwvtepPhysicalLocatorAugmentation(
- String.valueOf(otherDevice.getTunnelIp().getValue()));
+ .createHwvtepPhysicalLocatorAugmentation(otherDevice.getTunnelIp().stringValue());
RemoteUcastMacs remoteUcastMac = HwvtepSouthboundUtils.createRemoteUcastMac(hwVtepNodeId,
localUcastMac.getMacEntryKey().getValue().toLowerCase(Locale.getDefault()),
localUcastMac.getIpaddr(), logicalSwitchName, physLocatorAug);
continue;
}
HwvtepPhysicalLocatorAugmentation physLocatorAug = HwvtepSouthboundUtils
- .createHwvtepPhysicalLocatorAugmentation(String.valueOf(dpnTepIp.getValue()));
+ .createHwvtepPhysicalLocatorAugmentation(dpnTepIp.stringValue());
// TODO: Query ARP cache to get IP address corresponding to the
// MAC
RemoteUcastMacs remoteUcastMac = HwvtepSouthboundUtils.createRemoteUcastMac(hwVtepNodeId,
import org.opendaylight.ovsdb.utils.mdsal.utils.MdsalUtils;
import org.opendaylight.ovsdb.utils.southbound.utils.SouthboundUtils;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressBuilder;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefixBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406.BridgeRefInfo;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406.bridge.ref.info.BridgeRefEntry;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.meta.rev160406.bridge.ref.info.BridgeRefEntryKey;
Set<String> zonePrefixes = new HashSet<>();
Map<String, List<String>> tepTzMap = tunnelEndPoints.stream().collect(Collectors
- .toMap(tep -> String.valueOf(tep.getIpAddress().getValue()), this::getTepTransportZoneNames));
+ .toMap(tep -> tep.getIpAddress().stringValue(), this::getTepTransportZoneNames));
LOG.trace("Transport zone prefixes {}", tepTzMap);
handleRemovedLocalIps(mapDiff.entriesOnlyOnLeft(), dpId, zonePrefixes, tepTzMap, tx);
private List<String> getTepTransportZoneNames(TunnelEndPoints tep) {
List<TzMembership> tzMembershipList = tep.getTzMembership();
if (tzMembershipList == null) {
- LOG.debug("No TZ membership exist for TEP ip {}", tep.getIpAddress().getValue());
+ LOG.debug("No TZ membership exist for TEP ip {}", tep.getIpAddress().stringValue());
return Collections.emptyList();
}
}
if (localIp != null) {
- IpAddress nodeIp = new IpAddress(localIp.toCharArray());
+ IpAddress nodeIp = IpAddressBuilder.getDefaultInstance(localIp);
VtepsBuilder vtepsBuilder = new VtepsBuilder().setDpnId(dpnId).setIpAddress(nodeIp)
.setPortname(TUNNEL_PORT).setOptionOfTunnel(elanConfig.isUseOfTunnels());
subnets.getVteps().add(vtepsBuilder.build());
private void removeVtep(String zoneName, BigInteger dpId, @Nonnull WriteTransaction tx) {
InstanceIdentifier<Vteps> path = InstanceIdentifier.builder(TransportZones.class)
.child(TransportZone.class, new TransportZoneKey(zoneName))
- .child(Subnets.class, new SubnetsKey(new IpPrefix(ALL_SUBNETS.toCharArray())))
+ .child(Subnets.class, new SubnetsKey(IpPrefixBuilder.getDefaultInstance(ALL_SUBNETS)))
.child(Vteps.class, new VtepsKey(dpId, TUNNEL_PORT)).build();
tx.delete(LogicalDatastoreType.CONFIGURATION, path);
}
// search for relevant subnets for the given subnetIP, add one if it is
// necessary
private Subnets getOrAddSubnet(@Nonnull List<Subnets> subnets, @Nonnull String subnetIp) {
- IpPrefix subnetPrefix = new IpPrefix(subnetIp.toCharArray());
+ IpPrefix subnetPrefix = IpPrefixBuilder.getDefaultInstance(subnetIp);
for (Subnets subnet : subnets) {
if (subnet.getPrefix().equals(subnetPrefix)) {
private Subnets buildSubnets(String subnetIp) {
SubnetsBuilder subnetsBuilder = new SubnetsBuilder().setDeviceVteps(new ArrayList<>())
- .setGatewayIp(new IpAddress(ALL_SUBNETS_GW.toCharArray()))
- .withKey(new SubnetsKey(new IpPrefix(subnetIp.toCharArray()))).setVlanId(0)
+ .setGatewayIp(IpAddressBuilder.getDefaultInstance(ALL_SUBNETS_GW))
+ .withKey(new SubnetsKey(IpPrefixBuilder.getDefaultInstance(subnetIp))).setVlanId(0)
.setVteps(new ArrayList<>());
return subnetsBuilder.build();
}
import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepGlobalAugmentation;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.hwvtep.rev150901.HwvtepGlobalAugmentationBuilder;
physicalSwitchAugmentationBuilder.setHwvtepNodeDescription("description");
List<TunnelIps> tunnelIps = new ArrayList<>();
- IpAddress ip = new IpAddress("192.168.122.30".toCharArray());
+ IpAddress ip = new IpAddress(new Ipv4Address("192.168.122.30"));
tunnelIps.add(new TunnelIpsBuilder().withKey(new TunnelIpsKey(ip)).setTunnelIpsKey(ip).build());
physicalSwitchAugmentationBuilder.setTunnelIps(tunnelIps);
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableBiMap;
import com.google.common.collect.ImmutableList;
-
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.UUID;
-
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressBuilder;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Uri;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid;
public static LocalUcastMacs buildLocalUcastMacs(InstanceIdentifier<Node> nodeIid, String vmMac,
String vmip, String tepIp, String logicalSwitchName) {
LocalUcastMacsBuilder ucmlBuilder = new LocalUcastMacsBuilder();
- ucmlBuilder.setIpaddr(new IpAddress(vmip.toCharArray()));
+ ucmlBuilder.setIpaddr(IpAddressBuilder.getDefaultInstance(vmip));
ucmlBuilder.setMacEntryKey(new MacAddress(vmMac));
ucmlBuilder.setMacEntryUuid(getUUid(vmMac));
ucmlBuilder.setLocatorRef(buildLocatorRef(nodeIid, tepIp));
public static RemoteUcastMacs buildRemoteUcastMacs(InstanceIdentifier<Node> nodeIid, String vmMac,
String vmip, String tepIp, String logicalSwitchName) {
RemoteUcastMacsBuilder ucmlBuilder = new RemoteUcastMacsBuilder();
- ucmlBuilder.setIpaddr(new IpAddress(vmip.toCharArray()));
+ ucmlBuilder.setIpaddr(IpAddressBuilder.getDefaultInstance(vmip));
ucmlBuilder.setMacEntryKey(new MacAddress(vmMac));
ucmlBuilder.setMacEntryUuid(getUUid(vmMac));
ucmlBuilder.setLocatorRef(buildLocatorRef(nodeIid, tepIp));
new HwvtepPhysicalLocatorAugmentationBuilder();
tpAugmentationBuilder.setPhysicalLocatorUuid(getUUid(ip));
tpAugmentationBuilder.setEncapsulationType(createEncapsulationType("vxlan_over_ipv4"));
- tpAugmentationBuilder.setDstIp(new IpAddress(ip.toCharArray()));
+ tpAugmentationBuilder.setDstIp(IpAddressBuilder.getDefaultInstance(ip));
tpBuilder.addAugmentation(HwvtepPhysicalLocatorAugmentation.class, tpAugmentationBuilder.build());
}
return tpBuilder.build();
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
-
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
import org.opendaylight.genius.datastoreutils.SingleTransactionDataBroker;
import org.opendaylight.netvirt.elan.l2gw.nodehandlertest.GlobalAugmentationHelper;
import org.opendaylight.netvirt.elan.l2gw.nodehandlertest.TestBuilders;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressBuilder;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Uri;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid;
public class L2gwBuilders {
- private SingleTransactionDataBroker singleTransactionDataBroker;
+ private final SingleTransactionDataBroker singleTransactionDataBroker;
public L2gwBuilders(SingleTransactionDataBroker singleTransactionDataBroker) {
this.singleTransactionDataBroker = singleTransactionDataBroker;
physicalSwitchAugmentationBuilder.setHwvtepNodeName(new HwvtepNodeName(deviceName));
physicalSwitchAugmentationBuilder.setHwvtepNodeDescription("torNode");
List<TunnelIps> tunnelIps = new ArrayList<>();
- IpAddress ip = new IpAddress(tepIp.toCharArray());
+ IpAddress ip = IpAddressBuilder.getDefaultInstance(tepIp);
tunnelIps.add(new TunnelIpsBuilder().withKey(new TunnelIpsKey(ip)).setTunnelIpsKey(ip).build());
physicalSwitchAugmentationBuilder.setTunnelIps(tunnelIps);
nodeBuilder.addAugmentation(PhysicalSwitchAugmentation.class, physicalSwitchAugmentationBuilder.build());
nodeBuilder.setNodeId(nodeId.firstKeyOf(Node.class).getNodeId());
final List<LocalUcastMacs> localUcastMacses = new ArrayList<>();
LocalUcastMacsBuilder localUcastMacsBuilder = new LocalUcastMacsBuilder();
- localUcastMacsBuilder.setIpaddr(new IpAddress(ipAddr.toCharArray()));
+ localUcastMacsBuilder.setIpaddr(IpAddressBuilder.getDefaultInstance(ipAddr));
localUcastMacsBuilder.setMacEntryKey(new MacAddress(mac));
localUcastMacsBuilder.setMacEntryUuid(getUUid(mac));
localUcastMacsBuilder.setLocatorRef(TestBuilders.buildLocatorRef(nodeId, tepIp));
import java.util.concurrent.Future;
import javax.inject.Inject;
import javax.inject.Singleton;
-
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
if (tunnelInfo.isPresent()) {
List<TunnelEndPoints> nexthopIpList = tunnelInfo.get().getTunnelEndPoints();
if (nexthopIpList != null && !nexthopIpList.isEmpty()) {
- nextHopIp = String.valueOf(nexthopIpList.get(0).getIpAddress().getValue());
+ nextHopIp = nexthopIpList.get(0).getIpAddress().stringValue();
}
}
return nextHopIp;
import org.opendaylight.netvirt.vpnmanager.api.VpnExtraRouteHelper;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.iana._if.type.rev140508.L2vlan;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.iana._if.type.rev140508.Tunnel;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressBuilder;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.InterfaceType;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface.OperStatus;
Future<RpcResult<GetInternalOrExternalInterfaceNameOutput>> result;
try {
LOG.debug("Trying to fetch tunnel interface name for source dpn {} destIp {} tunType {}", srcDpId,
- dstIp.getValue(), tunnelType.getName());
+ dstIp.stringValue(), tunnelType.getName());
result = itmManager.getInternalOrExternalInterfaceName(new GetInternalOrExternalInterfaceNameInputBuilder()
.setSourceDpid(srcDpId)
.setDestinationIp(dstIp)
listAction.add(new ActionPushMpls().buildAction());
listAction.add(new ActionRegMove(actionKey++, FibConstants.NXM_REG_MAPPING
.get(index), 0, 19).buildAction());
- String tunnelInterfaceName = getTunnelInterfaceName(dpnId, new IpAddress(ipAddress.toCharArray()), tunnelType);
+ String tunnelInterfaceName = getTunnelInterfaceName(dpnId, IpAddressBuilder.getDefaultInstance(ipAddress),
+ tunnelType);
List<Action> egressActions = getEgressActions(tunnelInterfaceName, actionKey++);
if (!egressActions.isEmpty()) {
listAction.addAll(getEgressActions(tunnelInterfaceName, actionKey++));
return true;
}
- private void updateRAResponse(Ipv6RouterAdvertisementType raType, RouterSolicitationPacket pdu,
- RouterAdvertisementPacketBuilder raPacket,
- VirtualPort routerPort) {
+ private static void updateRAResponse(Ipv6RouterAdvertisementType raType, RouterSolicitationPacket pdu,
+ RouterAdvertisementPacketBuilder raPacket,
+ VirtualPort routerPort) {
short icmpv6RaFlags = 0;
String gatewayMac = null;
IpAddress gatewayIp;
if (!subnet.getIpv6RAMode().isEmpty()) {
if (Ipv6ServiceConstants.IPV6_AUTO_ADDRESS_SUBNETS.contains(subnet.getIpv6RAMode())) {
- autoConfigPrefixList.add(String.valueOf(subnet.getSubnetCidr().getValue()));
+ autoConfigPrefixList.add(subnet.getSubnetCidr().stringValue());
}
if (subnet.getIpv6RAMode().equalsIgnoreCase(Ipv6ServiceConstants.IPV6_DHCPV6_STATEFUL)) {
- statefulConfigPrefixList.add(String.valueOf(subnet.getSubnetCidr().getValue()));
+ statefulConfigPrefixList.add(subnet.getSubnetCidr().stringValue());
}
}
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Prefix;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action;
when(gwIpAddress.getIpv6Address()).thenReturn(new Ipv6Address("2001:db8::1"));
VirtualSubnet v6Subnet = VirtualSubnet.builder().gatewayIp(gwIpAddress)
- .subnetCidr(new IpPrefix("2001:db8::/64".toCharArray()))
+ .subnetCidr(new IpPrefix(new Ipv6Prefix("2001:db8::/64")))
.ipv6AddressMode(Ipv6ServiceConstants.IPV6_SLAAC).ipv6RAMode(Ipv6ServiceConstants.IPV6_SLAAC).build();
VirtualRouter virtualRouter = VirtualRouter.builder().build();
when(gwIpAddress.getIpv6Address()).thenReturn(new Ipv6Address("2001:db8:1111::1"));
VirtualSubnet v6Subnet1 = VirtualSubnet.builder().gatewayIp(gwIpAddress)
- .subnetCidr(new IpPrefix("2001:db8:1111::/64".toCharArray()))
+ .subnetCidr(new IpPrefix(new Ipv6Prefix("2001:db8:1111::/64")))
.ipv6AddressMode(Ipv6ServiceConstants.IPV6_SLAAC).ipv6RAMode(Ipv6ServiceConstants.IPV6_SLAAC).build();
VirtualRouter virtualRouter = VirtualRouter.builder().build();
v6Subnet1.setRouter(virtualRouter);
VirtualSubnet v6Subnet2 = VirtualSubnet.builder().gatewayIp(gwIpAddress)
- .subnetCidr(new IpPrefix("2001:db8:2222::/64".toCharArray()))
+ .subnetCidr(new IpPrefix(new Ipv6Prefix("2001:db8:2222::/64")))
.ipv6AddressMode(Ipv6ServiceConstants.IPV6_DHCPV6_STATELESS)
.ipv6RAMode(Ipv6ServiceConstants.IPV6_DHCPV6_STATELESS).build();
v6Subnet2.setRouter(virtualRouter);
VirtualSubnet v6Subnet3 = VirtualSubnet.builder().gatewayIp(gwIpAddress)
- .subnetCidr(new IpPrefix("2001:db8:3333::/64".toCharArray()))
+ .subnetCidr(new IpPrefix(new Ipv6Prefix("2001:db8:3333::/64")))
.ipv6AddressMode(Ipv6ServiceConstants.IPV6_DHCPV6_STATEFUL)
.ipv6RAMode(Ipv6ServiceConstants.IPV6_DHCPV6_STATEFUL).build();
v6Subnet3.setRouter(virtualRouter);
this.elementCache = elementCache;
}
- private String getPortIpv6Addresses(IVirtualPort vport) {
+ private static String getPortIpv6Addresses(IVirtualPort vport) {
List<Ipv6Address> ipv6Addresses = vport.getIpv6Addresses();
return ipv6Addresses.stream().map(Ipv6Address::getValue).collect(Collectors.joining(" "));
}
int count = 1;
List<IVirtualSubnet> vsubnets = elementCache.getSubnetCache();
for (IVirtualSubnet vsubnet : vsubnets) {
- tp.addRow(count++, String.valueOf(vsubnet.getSubnetUUID().getValue()),
- String.valueOf(vsubnet.getSubnetCidr().getValue()),
- vsubnet.getIpVersion());
+ tp.addRow(count++, String.valueOf(vsubnet.getSubnetUUID().getValue()),
+ vsubnet.getSubnetCidr().stringValue(), vsubnet.getIpVersion());
}
session.getConsole().print(tp.toString());
} else if (listResource.equalsIgnoreCase("routers")
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.ext.routers.Routers;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.ext.routers.routers.ExternalIps;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.external.subnets.Subnets;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.types.rev160517.IpPrefixOrAddress;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.types.rev160517.IpPrefixOrAddressBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.NxActionNatFlags;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.NxActionNatRangePresent;
import org.slf4j.Logger;
int rangePresent = NxActionNatRangePresent.NXNATRANGEIPV4MIN.getIntValue();
int flags = NxActionNatFlags.NXNATFSRC.getIntValue();
NxCtAction nxCtActionCommit = new ActionNxConntrack.NxNat(0, flags, rangePresent,
- new IpPrefixOrAddress(externalIp.toCharArray()).getIpAddress(),
- null,0, 0);
+ IpPrefixOrAddressBuilder.getDefaultInstance(externalIp).getIpAddress(), null,0, 0);
ctActionsListCommit.add(nxCtActionCommit);
int ctCommitFlag = 1;
ActionNxConntrack actionNxConntrackSubmit = new ActionNxConntrack(ctCommitFlag, 0, elanId,
private void hndlTepEvntsForDpn(StateTunnelList stateTunnelList, TunnelAction tunnelAction) {
final BigInteger srcDpnId = new BigInteger(stateTunnelList.getSrcInfo().getTepDeviceId());
- final String srcTepIp = String.valueOf(stateTunnelList.getSrcInfo().getTepIp().getValue());
- final String destTepIp = String.valueOf(stateTunnelList.getDstInfo().getTepIp().getValue());
+ final String srcTepIp = stateTunnelList.getSrcInfo().getTepIp().stringValue();
+ final String destTepIp = stateTunnelList.getDstInfo().getTepIp().stringValue();
LOG.trace("hndlTepEvntsForDpn : Handle tunnel event for srcDpn {} SrcTepIp {} DestTepIp {} ",
srcDpnId, srcTepIp, destTepIp);
int tunTypeVal = getTunnelType(stateTunnelList);
import org.opendaylight.yang.gen.v1.urn.huawei.params.xml.ns.yang.l3vpn.rev140815.vpn.interfaces.VpnInterface;
import org.opendaylight.yang.gen.v1.urn.huawei.params.xml.ns.yang.l3vpn.rev140815.vpn.interfaces.VpnInterfaceKey;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefixBuilder;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state.Interface;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.OutputActionCase;
}
public static boolean isIPv6Subnet(String prefix) {
- return new IpPrefix(prefix.toCharArray()).getIpv6Prefix() != null;
+ return IpPrefixBuilder.getDefaultInstance(prefix).getIpv6Prefix() != null;
}
static InstanceIdentifier<DpnRoutersList> getDpnRoutersId(BigInteger dpnId) {
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
-
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.genius.datastoreutils.listeners.DataTreeEventCallbackRegistrar;
import org.opendaylight.genius.infra.Datastore.Configuration;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.ProviderTypes;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.ext.routers.Routers;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.natservice.rev160111.ext.routers.routers.ExternalIps;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.types.rev160517.IpPrefixOrAddress;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.types.rev160517.IpPrefixOrAddressBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.NxActionNatFlags;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.action.rev140421.NxActionNatRangePresent;
import org.slf4j.Logger;
int rangePresent = NxActionNatRangePresent.NXNATRANGEIPV4MIN.getIntValue();
int flags = NxActionNatFlags.NXNATFSRC.getIntValue();
ActionNxConntrack.NxCtAction nxCtActionCommit = new ActionNxConntrack.NxNat(0, flags, rangePresent,
- new IpPrefixOrAddress(externalIp.toCharArray()).getIpAddress(),
- null,0, 0);
+ IpPrefixOrAddressBuilder.getDefaultInstance(externalIp).getIpAddress(), null,0, 0);
ctActionsListCommit.add(nxCtActionCommit);
int ctCommitFlag = 1;
ActionNxConntrack actionNxConntrackSubmit = new ActionNxConntrack(ctCommitFlag, 0, elanId,
public ListenableFuture<RpcResult<GetNatTranslationsForNetworkAndIpaddressOutput>>
getNatTranslationsForNetworkAndIpaddress(GetNatTranslationsForNetworkAndIpaddressInput input) {
- String ipAddress = String.valueOf(input.getIpAddress().getValue());
+ String ipAddress = input.getIpAddress().stringValue();
RpcResultBuilder<GetNatTranslationsForNetworkAndIpaddressOutput> rpcResultBuilder = null;
GetNatTranslationsForNetworkAndIpaddressOutputBuilder output = null;
subNet = nvpnManager.getNeutronSubnet(subnetUuid);
for (AllocationPools allocationPool : subNet.getAllocationPools()) {
if (NatUtil.isIpInSubnet(ipAddress,
- String.valueOf(allocationPool.getStart().getValue()),
- String.valueOf(allocationPool.getEnd().getValue()))) {
+ allocationPool.getStart().stringValue(),
+ allocationPool.getEnd().stringValue())) {
LOG.debug("getNatTranslationsForNetworkAndIpaddress : IP Adderess {} falls within the Subnet {}",
ipAddress, subNet.getUuid().getValue());
isIpInSubnet = Boolean.TRUE;
public String toString() {
List<String> lstTunnelIps = new ArrayList<>();
for (IpAddress ip : this.tunnelIps) {
- lstTunnelIps.add(String.valueOf(ip.getValue()));
+ lstTunnelIps.add(ip.stringValue());
}
List<String> lstMacs =
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
-
import java.time.Duration;
import java.util.ArrayList;
import java.util.Collections;
&& portIP.getIpAddress().getIpv6Address() != null) {
portIsIpv6 = true;
}
- String ipValue = String.valueOf(portIP.getIpAddress().getValue());
+ String ipValue = portIP.getIpAddress().stringValue();
Uuid subnetId = portIP.getSubnetId();
nvpnManager.updateSubnetNodeWithFixedIp(subnetId, routerId,
routerPort.getUuid(), ipValue, routerPort.getMacAddress().getValue(), vpnId);
nvpnManager.createVpnInterface(listVpnIds, routerPort, null);
}
for (FixedIps portIP : routerPort.getFixedIps()) {
- String ipValue = String.valueOf(portIP.getIpAddress().getValue());
- IpVersionChoice version = neutronvpnUtils.getIpVersionFromString(ipValue);
+ String ipValue = portIP.getIpAddress().stringValue();
+ IpVersionChoice version = NeutronvpnUtils.getIpVersionFromString(ipValue);
if (neutronvpnUtils.shouldVpnHandleIpVersionChoiceChangeToAdd(version, vpnId)) {
neutronvpnUtils.updateVpnInstanceWithIpFamily(vpnId.getValue(),
version, true);
// router Port have either IPv4 or IPv6, never both
if (neutronvpnUtils.shouldVpnHandleIpVersionChangeToRemove(sn, vpnId)) {
vpnInstanceIpVersionRemoved = true;
- vpnInstanceIpVersionToRemove = neutronvpnUtils.getIpVersionFromString(sn.getSubnetIp());
+ vpnInstanceIpVersionToRemove = NeutronvpnUtils.getIpVersionFromString(sn.getSubnetIp());
}
- String ipValue = String.valueOf(portIP.getIpAddress().getValue());
+ String ipValue = portIP.getIpAddress().stringValue();
neutronvpnUtils.removeVpnPortFixedIpToPort(vpnId.getValue(), ipValue, confTx);
// NOTE: Please donot change the order of calls to removeSubnetFromVpn and
// and updateSubnetNodeWithFixedIP
if (network == null) {
return;
}
- boolean isExternal = neutronvpnUtils.getIsExternal(network);
+ boolean isExternal = NeutronvpnUtils.getIsExternal(network);
if (isExternal) {
Uuid vpnInternetId = neutronvpnUtils.getVpnForNetwork(networkId);
if (vpnInternetId != null) {
if (sn.getNetworkId() == networkId) {
continue;
}
- if (neutronvpnUtils.getIpVersionFromString(sn.getSubnetIp()) != IpVersionChoice.IPV6) {
+ if (NeutronvpnUtils.getIpVersionFromString(sn.getSubnetIp()) != IpVersionChoice.IPV6) {
continue;
}
nvpnManager.addSubnetToVpn(null, sn.getId(), vpnInternetId);
jobCoordinator.enqueueJob("PORT- " + portName, () -> {
// add direct port to subnetMaps config DS
if (!(NeutronUtils.isPortVnicTypeNormal(port)
- || (isPortTypeSwitchdev(port)
- && isSupportedVnicTypeByHost(port, NeutronConstants.VNIC_TYPE_DIRECT)))) {
+ || isPortTypeSwitchdev(port)
+ && isSupportedVnicTypeByHost(port, NeutronConstants.VNIC_TYPE_DIRECT))) {
for (FixedIps ip: portIpAddrsList) {
nvpnManager.updateSubnetmapNodeWithPorts(ip.getSubnetId(), null, portId);
}
if (NeutronConstants.DEVICE_OWNER_GATEWAY_INF.equals(port.getDeviceOwner())
|| NeutronConstants.DEVICE_OWNER_FLOATING_IP.equals(port.getDeviceOwner())) {
- String ipAddress = String.valueOf(ip.getIpAddress().getValue());
+ String ipAddress = ip.getIpAddress().stringValue();
if (vpnId != null) {
neutronvpnUtils.removeVpnPortFixedIpToPort(vpnId.getValue(), ipAddress, confTx);
}
}
}
}
- Set<Uuid> newVpnIds = new HashSet();
+ Set<Uuid> newVpnIds = new HashSet<>();
Set<Uuid> newRouterIds = new HashSet<>();
for (Uuid snId: updateSnMapsIds) {
Subnetmap subnetMapNew = nvpnManager.updateSubnetmapNodeWithPorts(snId, portupdate.getUuid(), null);
List<Routes> otherRoutes = new ArrayList<>();
HashMap<String, InterVpnLink> nexthopsXinterVpnLinks = new HashMap<>();
for (Routes route : routes) {
- String nextHop = String.valueOf(route.getNexthop().getValue());
+ String nextHop = route.getNexthop().stringValue();
// Nexthop is another VPN?
Optional<InterVpnLink> interVpnLink = neutronvpnUtils.getInterVpnLinkByEndpointIp(nextHop);
if (interVpnLink.isPresent()) {
nexthopsXinterVpnLinks.put(nextHop, interVpnLink.get());
} else {
LOG.error("Failed installing route to {}. Reason: InterVPNLink {} is not Active",
- String.valueOf(route.getDestination().getValue()), interVpnLink.get().getName());
+ route.getDestination().stringValue(), interVpnLink.get().getName());
}
} else {
otherRoutes.add(route);
subnetId.getValue(), network);
return;
}
- handleNeutronSubnetDeleted(subnetId, networkId, String.valueOf(input.getCidr().getValue()));
+ handleNeutronSubnetDeleted(subnetId, networkId, input.getCidr().stringValue());
externalSubnetHandler.handleExternalSubnetRemoved(network, subnetId);
neutronvpnUtils.removeFromSubnetCache(input);
}
Uuid subnetId = subnet.getUuid();
ProviderTypes providerType = NeutronvpnUtils.getProviderNetworkType(network);
String segmentationId = NeutronvpnUtils.getSegmentationIdFromNeutronNetwork(network);
- nvpnManager.createSubnetmapNode(subnetId, String.valueOf(subnet.getCidr().getValue()),
- subnet.getTenantId(), networkId,
+ nvpnManager.createSubnetmapNode(subnetId, subnet.getCidr().stringValue(), subnet.getTenantId(), networkId,
providerType != null ? NetworkAttributes.NetworkType.valueOf(providerType.getName()) : null,
segmentationId != null ? Long.parseLong(segmentationId) : 0L);
createSubnetToNetworkMapping(subnetId, networkId);
String infName = port.getUuid().getValue();
LOG.trace("neutronVpnManager: create config adjacencies for Port: {}", infName);
for (FixedIps ip : port.getFixedIps()) {
- String ipValue = String.valueOf(ip.getIpAddress().getValue());
+ String ipValue = ip.getIpAddress().stringValue();
String ipPrefix = ip.getIpAddress().getIpv4Address() != null ? ipValue + "/32" : ipValue + "/128";
if (sn != null && !FibHelper.doesPrefixBelongToSubnet(ipPrefix, sn.getSubnetIp(), false)) {
continue;
}
List<FixedIps> ips = port.getFixedIps();
for (FixedIps ip : ips) {
- String ipValue = String.valueOf(ip.getIpAddress().getValue());
+ String ipValue = ip.getIpAddress().stringValue();
neutronvpnUtils.removeVpnPortFixedIpToPort(vpnId.getValue(),
ipValue, writeConfigTxn);
}
}
List<FixedIps> ips = port.getFixedIps();
for (FixedIps ip : ips) {
- String ipValue = String.valueOf(ip.getIpAddress().getValue());
+ String ipValue = ip.getIpAddress().stringValue();
if (oldVpnId != null) {
neutronvpnUtils.removeVpnPortFixedIpToPort(oldVpnId.getValue(),
ipValue, writeConfigTxn);
vpnIdentifier);
// eliminating implicitly created (router or VLAN provider external network specific) VPN from
// getL3VPN output
- if (optionalVpn.isPresent() && (optionalVpn.get().getIpv4Family().getRouteDistinguisher() != null)
- || (optionalVpn.get().getIpv6Family().getRouteDistinguisher() != null)) {
+ if (optionalVpn.isPresent() && optionalVpn.get().getIpv4Family().getRouteDistinguisher() != null
+ || optionalVpn.get().getIpv6Family().getRouteDistinguisher() != null) {
vpns.add(optionalVpn.get());
} else {
result.set(
public void addInterVpnRoutes(Uuid vpnName, List<Routes> interVpnLinkRoutes,
HashMap<String, InterVpnLink> nexthopsXinterVpnLinks) {
for (Routes route : interVpnLinkRoutes) {
- String nexthop = String.valueOf(route.getNexthop().getValue());
- String destination = String.valueOf(route.getDestination().getValue());
+ String nexthop = route.getNexthop().stringValue();
+ String destination = route.getDestination().stringValue();
InterVpnLink interVpnLink = nexthopsXinterVpnLinks.get(nexthop);
if (isNexthopTheOtherVpnLinkEndpoint(nexthop, vpnName.getValue(), interVpnLink)) {
AddStaticRouteInput rpcInput =
} else {
// Any other case is a fault.
LOG.warn("route with destination {} and nexthop {} does not apply to any InterVpnLink",
- String.valueOf(route.getDestination().getValue()), nexthop);
+ route.getDestination().stringValue(), nexthop);
continue;
}
}
public void removeInterVpnRoutes(Uuid vpnName, List<Routes> interVpnLinkRoutes,
HashMap<String, InterVpnLink> nexthopsXinterVpnLinks) {
for (Routes route : interVpnLinkRoutes) {
- String nexthop = String.valueOf(route.getNexthop().getValue());
- String destination = String.valueOf(route.getDestination().getValue());
+ String nexthop = route.getNexthop().stringValue();
+ String destination = route.getDestination().stringValue();
InterVpnLink interVpnLink = nexthopsXinterVpnLinks.get(nexthop);
if (isNexthopTheOtherVpnLinkEndpoint(nexthop, vpnName.getValue(), interVpnLink)) {
RemoveStaticRouteInput rpcInput =
} else {
// Any other case is a fault.
LOG.warn("route with destination {} and nexthop {} does not apply to any InterVpnLink",
- String.valueOf(route.getDestination().getValue()), nexthop);
+ route.getDestination().stringValue(), nexthop);
continue;
}
}
if (route == null || route.getNexthop() == null || route.getDestination() == null) {
LOG.error("Incorrect input received for extra route. {}", route);
} else {
- String nextHop = String.valueOf(route.getNexthop().getValue());
- String destination = String.valueOf(route.getDestination().getValue());
+ String nextHop = route.getNexthop().stringValue();
+ String destination = route.getDestination().stringValue();
if (!nextHop.equals(fixedIp)) {
LOG.trace("FixedIP {} is not extra route nexthop for destination {}", fixedIp, destination);
continue;
if (route == null || route.getNexthop() == null || route.getDestination() == null) {
LOG.error("Incorrect input received for extra route. {}", route);
} else {
- String nextHop = String.valueOf(route.getNexthop().getValue());
- String destination = String.valueOf(route.getDestination().getValue());
+ String nextHop = route.getNexthop().stringValue();
+ String destination = route.getDestination().stringValue();
String infName = neutronvpnUtils.getNeutronPortNameFromVpnPortFixedIp(vpnId.getValue(),
nextHop);
if (infName != null) {
}
for (Routes route : routeList) {
// count the number of nexthops for each same route.getDestingation().getValue()
- String destination = String.valueOf(route.getDestination().getValue());
- String nextHop = String.valueOf(route.getNexthop().getValue());
- List<String> nextHopList = new ArrayList();
+ String destination = route.getDestination().stringValue();
+ String nextHop = route.getNexthop().stringValue();
+ List<String> nextHopList = new ArrayList<>();
nextHopList.add(nextHop);
int nbNextHops = 0;
for (Routes routeTmp : routeList) {
- String routeDest = String.valueOf(routeTmp.getDestination().getValue());
+ String routeDest = routeTmp.getDestination().stringValue();
if (!destination.equals(routeDest)) {
continue;
}
- String routeNextH = String.valueOf(routeTmp.getNexthop().getValue());
+ String routeNextH = routeTmp.getNexthop().stringValue();
if (nextHop.equals(routeNextH)) {
continue;
}
nbNextHops++;
- nextHopList.add(new String(routeTmp.getNexthop().getValue()));
+ nextHopList.add(routeTmp.getNexthop().stringValue());
}
final List<String> rdList = new ArrayList<>();
if (vpnInstance.getIpv4Family() != null
// 4. Prefix in question
detailsAlarm.append(" for prefix: ");
- detailsAlarm.append(route.getDestination().getValue());
+ detailsAlarm.append(route.getDestination().stringValue());
// 5. List of NHs for the prefix
detailsAlarm.append(" for nextHops: ");
for (Routes route : routeList) {
if (route != null && route.getNexthop() != null && route.getDestination() != null) {
boolean isLockAcquired = false;
- String nextHop = String.valueOf(route.getNexthop().getValue());
- String destination = String.valueOf(route.getDestination().getValue());
+ String nextHop = route.getNexthop().stringValue();
+ String destination = route.getDestination().stringValue();
String infName = neutronvpnUtils.getNeutronPortNameFromVpnPortFixedIp(vpnId.getValue(),
nextHop);
if (infName == null) {
+ "another VPN %s", nw.getValue(), networkVpnId.getValue()));
continue;
}
- if (neutronvpnUtils.getIsExternal(network) && !associateExtNetworkToVpn(vpnId, network)) {
+ if (NeutronvpnUtils.getIsExternal(network) && !associateExtNetworkToVpn(vpnId, network)) {
LOG.error("associateNetworksToVpn: Failed to associate Provider Network {} with VPN {}",
nw.getValue(), vpnId.getValue());
failedNwList.add(String.format("Failed to associate Provider Network %s with VPN %s",
neutronvpnUtils.updateVpnInstanceWithIpFamily(vpnId.getValue(),
NeutronvpnUtils.getIpVersionFromString(subnetmap.getSubnetIp()), true);
}
- if (!neutronvpnUtils.getIsExternal(network)) {
+ if (!NeutronvpnUtils.getIsExternal(network)) {
LOG.debug("associateNetworksToVpn: Add subnet {} to VPN {}", subnetId.getValue(),
vpnId.getValue());
addSubnetToVpn(vpnId, subnetId, null);
Subnetmap subnetmap = neutronvpnUtils.getSubnetmap(subnet);
if (neutronvpnUtils.shouldVpnHandleIpVersionChangeToRemove(subnetmap, vpnId)) {
IpVersionChoice ipVersionsToRemove = IpVersionChoice.UNDEFINED;
- IpVersionChoice ipVersion = neutronvpnUtils.getIpVersionFromString(subnetmap.getSubnetIp());
+ IpVersionChoice ipVersion = NeutronvpnUtils.getIpVersionFromString(subnetmap.getSubnetIp());
neutronvpnUtils.updateVpnInstanceWithIpFamily(vpnId.getValue(),
ipVersionsToRemove.addVersion(ipVersion), false);
}
if (port != null) {
List<FixedIps> fixedIPs = port.getFixedIps();
for (FixedIps ip : fixedIPs) {
- fixedIPList.add(String.valueOf(ip.getIpAddress().getValue()));
+ fixedIPList.add(ip.getIpAddress().stringValue());
}
} else {
returnMsg.append("neutron port: ").append(portId.getValue()).append(" not found");
}
}
- private int externalNetworkChanged(Router original, Router update) {
+ private static int externalNetworkChanged(Router original, Router update) {
String origExtNet = null;
String newExtNet = null;
if (original != null && original.getExternalGatewayInfo() != null) {
}
}
- private boolean snatSettingChanged(Router orig, Router update) {
+ private static boolean snatSettingChanged(Router orig, Router update) {
ExternalGatewayInfo origExtGw = null;
ExternalGatewayInfo newExtGw = null;
if (orig != null && orig.getExternalGatewayInfo() != null) {
return false;
}
- private boolean externalFixedIpsChanged(Router orig, Router update) {
+ private static boolean externalFixedIpsChanged(Router orig, Router update) {
ExternalGatewayInfo origExtGw = null;
ExternalGatewayInfo newExtGw = null;
if (orig != null && orig.getExternalGatewayInfo() != null) {
List<ExternalFixedIps> origExtFixedIps = origExtGw.getExternalFixedIps();
HashSet<String> origFixedIpSet = new HashSet<>();
for (ExternalFixedIps fixedIps : origExtFixedIps) {
- origFixedIpSet.add(String.valueOf(fixedIps.getIpAddress().getValue()));
+ origFixedIpSet.add(fixedIps.getIpAddress().stringValue());
}
List<ExternalFixedIps> newExtFixedIps = newExtGw.getExternalFixedIps();
HashSet<String> updFixedIpSet = new HashSet<>();
for (ExternalFixedIps fixedIps : newExtFixedIps) {
- updFixedIpSet.add(String.valueOf(fixedIps.getIpAddress().getValue()));
+ updFixedIpSet.add(fixedIps.getIpAddress().stringValue());
}
// returns true if external subnets have changed
return !origFixedIpSet.equals(updFixedIpSet) ? true : false;
if (sn.getInternetVpnId() == null) {
continue;
}
- IpVersionChoice ipVers = neutronvpnUtils.getIpVersionFromString(sn.getSubnetIp());
+ IpVersionChoice ipVers = NeutronvpnUtils.getIpVersionFromString(sn.getSubnetIp());
if (ipVers == IpVersionChoice.IPV6) {
LOG.debug("addExternalNetworkToRouter : setup vpnInternet IPv6 for vpnExternal {} subnetmap {}",
vpnExternal, sn);
List<Uuid> submapIds = neutronvpnUtils.getPrivateSubnetsToExport(net);
for (Uuid snId : submapIds) {
Subnetmap subnetMap = neutronvpnUtils.getSubnetmap(snId);
- if ((subnetMap == null) || (subnetMap.getInternetVpnId() == null)) {
+ if (subnetMap == null || subnetMap.getInternetVpnId() == null) {
LOG.error("removeExternalNetworkFromRouter: Can not find Subnetmap for SubnetId {} in ConfigDS",
snId.getValue());
continue;
}
}
- private Subnets createSubnets(Uuid subnetId, Uuid networkId, List<Uuid> routerIds) {
+ private static Subnets createSubnets(Uuid subnetId, Uuid networkId, List<Uuid> routerIds) {
SubnetsBuilder subnetsBuilder = new SubnetsBuilder();
subnetsBuilder.withKey(new SubnetsKey(subnetId));
subnetsBuilder.setId(subnetId);
}
}
- private Set<Uuid> getExternalSubnetsUuidsSetForFixedIps(List<ExternalFixedIps> externalFixedIps) {
+ private static Set<Uuid> getExternalSubnetsUuidsSetForFixedIps(List<ExternalFixedIps> externalFixedIps) {
Set<Uuid> subnetsUuidsSet = new HashSet<>();
for (ExternalFixedIps externalFixedIp : externalFixedIps) {
subnetsUuidsSet.add(externalFixedIp.getSubnetId());
return subnetsList;
}
- private void addExternalFixedIpToExternalIpsList(List<ExternalIps> externalIps, ExternalFixedIps fixedIps) {
+ private static void addExternalFixedIpToExternalIpsList(List<ExternalIps> externalIps, ExternalFixedIps fixedIps) {
Uuid subnetId = fixedIps.getSubnetId();
- String ip = String.valueOf(fixedIps.getIpAddress().getValue());
+ String ip = fixedIps.getIpAddress().stringValue();
ExternalIpsBuilder externalIpsBuilder = new ExternalIpsBuilder();
externalIpsBuilder.withKey(new ExternalIpsKey(ip, subnetId));
externalIpsBuilder.setIpAddress(ip);
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import java.util.stream.Collectors;
-
import javax.annotation.Nonnull;
import javax.inject.Inject;
import javax.inject.Singleton;
-
import org.apache.commons.lang3.StringUtils;
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.types.rev160517.IpPrefixOrAddress ipAddress) {
AllowedAddressPairsBuilder aclAllowedAdressPairBuilder = new AllowedAddressPairsBuilder();
aclAllowedAdressPairBuilder.setMacAddress(macAddress);
- if (ipAddress != null && ipAddress.getValue() != null) {
+ if (ipAddress != null && ipAddress.stringValue() != null) {
if (ipAddress.getIpPrefix() != null) {
aclAllowedAdressPairBuilder.setIpAddress(new IpPrefixOrAddress(ipAddress.getIpPrefix()));
} else {
List<AllowedAddressPairs> aclAllowedAddressPairs = new ArrayList<>();
for (FixedIps fixedIp : fixedIps) {
aclAllowedAddressPairs.add(getAclAllowedAddressPairs(macAddress,
- new org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.types.rev160517.IpPrefixOrAddress(
- fixedIp.getIpAddress().getValue())));
+ org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.types.rev160517.IpPrefixOrAddressBuilder
+ .getDefaultInstance(fixedIp.getIpAddress().stringValue())));
}
return aclAllowedAddressPairs;
}
protected static AllowedAddressPairs updateIPv6LinkLocalAddressForAclService(MacAddress macAddress) {
IpAddress ipv6LinkLocalAddress = getIpv6LinkLocalAddressFromMac(macAddress);
return getAclAllowedAddressPairs(macAddress,
- new org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.types.rev160517.IpPrefixOrAddress(
- ipv6LinkLocalAddress.getValue()));
+ org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.types.rev160517.IpPrefixOrAddressBuilder
+ .getDefaultInstance(
+ ipv6LinkLocalAddress.stringValue()));
}
/**
.class).child(Subnet.class, subnetkey);
Optional<Subnet> subnet = read(LogicalDatastoreType.CONFIGURATION, subnetidentifier);
if (subnet.isPresent()) {
- String cidr = String.valueOf(subnet.get().getCidr().getValue());
+ String cidr = subnet.get().getCidr().stringValue();
// Extract the prefix length from cidr
String[] parts = cidr.split("/");
if (parts.length == 2) {
interfaceID.append(StringUtils.leftPad(Integer.toHexString(0xFF & octets[5]), 2, "0"));
Ipv6Address ipv6LLA = new Ipv6Address("fe80:0:0:0:" + interfaceID.toString());
- IpAddress ipAddress = new IpAddress(ipv6LLA.getValue().toCharArray());
+ IpAddress ipAddress = new IpAddress(ipv6LLA);
return ipAddress;
}
}
Long vpnId = vpnInstanceOpDataEntry.getVpnId();
List<Uuid> routerIds = getRouterIdsfromVpnInstance(vpnInstanceOpDataEntry.getVrfId());
- if ((routerIds == null) || (routerIds.isEmpty())) {
+ if (routerIds == null || routerIds.isEmpty()) {
LOG.error("updateVpnInstanceWithFallback: router not found for vpn {}", vpnName);
return;
}
if (tunnelInfo.isPresent()) {
List<TunnelEndPoints> nexthopIpList = tunnelInfo.get().getTunnelEndPoints();
if (nexthopIpList != null && !nexthopIpList.isEmpty()) {
- nextHopIp = new String(nexthopIpList.get(0).getIpAddress().getValue());
+ nextHopIp = nexthopIpList.get(0).getIpAddress().stringValue();
}
}
return nextHopIp;
import org.opendaylight.openflowplugin.libraries.liblldp.Packet;
import org.opendaylight.openflowplugin.libraries.liblldp.PacketException;
import org.opendaylight.yang.gen.v1.urn.huawei.params.xml.ns.yang.l3vpn.rev140815.vpn.interfaces.VpnInterface;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressBuilder;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefixBuilder;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid;
SubnetOpDataEntry subOpEntry = optionalSubs.get();
if (subOpEntry.getNhDpnId() != null) {
LOG.trace("{} getTargetDpnForPacketOut: Viewing Subnet {}", LOGGING_PREFIX, subnetId.getValue());
- IpPrefix cidr = new IpPrefix(subOpEntry.getSubnetCidr().toCharArray());
- boolean match = NWUtil.isIpAddressInRange(new IpAddress(ipAddress.toCharArray()), cidr);
+ IpPrefix cidr = IpPrefixBuilder.getDefaultInstance(subOpEntry.getSubnetCidr());
+ boolean match = NWUtil.isIpAddressInRange(IpAddressBuilder.getDefaultInstance(ipAddress), cidr);
LOG.trace("{} getTargetDpnForPacketOut: Viewing Subnet {} matching {}", LOGGING_PREFIX,
subnetId.getValue(), match);
if (match) {
//Remove the corresponding nexthop from the routepath under extraroute in fibentries.
BigInteger srcDpnId = new BigInteger(update.getSrcInfo().getTepDeviceId());
- String srcTepIp = String.valueOf(update.getSrcInfo().getTepIp().getValue());
+ String srcTepIp = update.getSrcInfo().getTepIp().stringValue();
List<VpnInstanceOpDataEntry> vpnInstanceOpData = vpnUtil.getAllVpnInstanceOpData();
if (vpnInstanceOpData == null) {
LOG.trace("update: No vpnInstanceOpdata present");
@SuppressWarnings("checkstyle:IllegalCatch")
private void handleTunnelEventForDPN(StateTunnelList stateTunnelList, TunnelAction tunnelAction) {
final BigInteger srcDpnId = new BigInteger(stateTunnelList.getSrcInfo().getTepDeviceId());
- final String srcTepIp = String.valueOf(stateTunnelList.getSrcInfo().getTepIp().getValue());
- String destTepIp = String.valueOf(stateTunnelList.getDstInfo().getTepIp().getValue());
+ final String srcTepIp = stateTunnelList.getSrcInfo().getTepIp().stringValue();
+ String destTepIp = stateTunnelList.getDstInfo().getTepIp().stringValue();
String rd;
BigInteger remoteDpnId = null;
boolean isTepDeletedOnDpn = false;
String rd;
String intfName = cfgVpnInterface.getName();
final BigInteger srcDpnId = new BigInteger(stateTunnelList.getSrcInfo().getTepDeviceId());
- String destTepIp = String.valueOf(stateTunnelList.getDstInfo().getTepIp().getValue());
- String srcTepIp = String.valueOf(stateTunnelList.getSrcInfo().getTepIp().getValue());
+ String destTepIp = stateTunnelList.getDstInfo().getTepIp().stringValue();
+ String srcTepIp = stateTunnelList.getSrcInfo().getTepIp().stringValue();
int tunTypeVal = getTunnelType(stateTunnelList);
BigInteger remoteDpnId = null;
if (tunTypeVal == VpnConstants.ITMTunnelLocType.Internal.getValue()) {
private void programDcGwLoadBalancingGroup(StateTunnelList tunnelState, int addOrRemove) {
IpAddress dcGwIp = tunnelState.getDstInfo().getTepIp();
- String dcGwIpAddress = String.valueOf(dcGwIp.getValue());
+ String dcGwIpAddress = dcGwIp.stringValue();
List<String> availableDcGws = getDcGwIps();
BigInteger dpId = new BigInteger(tunnelState.getSrcInfo().getTepDeviceId());
boolean isTunnelUp = TunnelOperStatus.Up == tunnelState.getOperState();
return dcGatewayIpListConfig.getDcGatewayIp()
.stream()
.filter(dcGwIp -> dcGwIp.getTunnnelType().equals(TunnelTypeMplsOverGre.class))
- .map(dcGwIp -> String.valueOf(dcGwIp.getIpAddress().getValue())).sorted()
+ .map(dcGwIp -> dcGwIp.getIpAddress().stringValue()).sorted()
.collect(toList());
}
WriteTransaction writeConfigTxn,
WriteTransaction writeOperTxn) {
- String srcTepIp = String.valueOf(stateTunnelList.getSrcInfo().getTepIp().getValue());
+ String srcTepIp = stateTunnelList.getSrcInfo().getTepIp().stringValue();
BigInteger srcDpnId = new BigInteger(stateTunnelList.getSrcInfo().getTepDeviceId());
AdjacenciesOp adjacencies = vpnInterface.augmentation(AdjacenciesOp.class);
List<Adjacency> adjList = adjacencies != null ? adjacencies.getAdjacency() : new ArrayList<>();
String prefix = null;
long label = 0;
boolean isNextHopRemoveReqd = false;
- String srcTepIp = String.valueOf(stateTunnelList.getSrcInfo().getTepIp().getValue());
+ String srcTepIp = stateTunnelList.getSrcInfo().getTepIp().stringValue();
BigInteger srcDpnId = new BigInteger(stateTunnelList.getSrcInfo().getTepDeviceId());
String vpnName = vpnInterface.getVpnInstanceName();
long vpnId = vpnUtil.getVpnId(vpnName);
LOG.info("Could not retrieve VpnMaps object from Configurational DS");
return new HashMap<>();
}
- Map<String,String> vmap = new HashMap<String,String>();
+ Map<String,String> vmap = new HashMap<>();
final List<VpnMap> VpnMapList = optVpnMaps.get().getVpnMap();
for (VpnMap map : VpnMapList) {
if (map.getRouterIds() == null) {
IpAddress nhIpAddr = route.getNexthop();
String routeNextHop = nhIpAddr.getIpv4Address() != null ? nhIpAddr.getIpv4Address().getValue()
: nhIpAddr.getIpv6Address().getValue();
- String destination = String.valueOf(route.getDestination().getValue());
+ String destination = route.getDestination().stringValue();
// is nexthop the other endpoint's IP
String otherEndpoint = ivpnLink.getOtherEndpoint(vpnId);
import org.opendaylight.netvirt.vpnmanager.VpnUtil;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefixBuilder;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.idmanager.rev160406.IdManagerService;
import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.LearntVpnVipToPortEventAction;
List<Adjacency> adjacencies = vpnUtil.getAdjacenciesForVpnInterfaceFromConfig(srcInterface);
if (adjacencies != null) {
for (Adjacency adj : adjacencies) {
- IpPrefix ipPrefix = new IpPrefix(adj.getIpAddress().toCharArray());
+ IpPrefix ipPrefix = IpPrefixBuilder.getDefaultInstance(adj.getIpAddress());
if (NWUtil.isIpAddressInRange(srcIP, ipPrefix)) {
return;
}
}
LOG.trace("ARP/NA Notification Response Received from interface {} and IP {} having MAC {}, learning MAC",
- srcInterface, String.valueOf(srcIP.getValue()), srcMac.getValue());
+ srcInterface, srcIP.stringValue(), srcMac.getValue());
processIpLearning(srcInterface, srcIP, srcMac, metadata, targetIP);
}
if (metadata != null && !Objects.equals(metadata, BigInteger.ZERO)) {
Optional<List<String>> vpnList = vpnUtil.getVpnHandlingIpv4AssociatedWithInterface(srcInterface);
if (vpnList.isPresent()) {
- String srcIpToQuery = String.valueOf(srcIP.getValue());
- String destIpToQuery = String.valueOf(dstIP.getValue());
+ String srcIpToQuery = srcIP.stringValue();
+ String destIpToQuery = dstIP.stringValue();
for (String vpnName : vpnList.get()) {
LOG.info("Received ARP/NA for sender MAC {} and sender IP {} via interface {}",
srcMac.getValue(), srcIpToQuery, srcInterface);
private void learnMacFromIncomingPacket(String vpnName, String srcInterface, IpAddress srcIP, MacAddress srcMac,
IpAddress dstIP) {
- String srcIpToQuery = String.valueOf(srcIP.getValue());
- String destIpToQuery = String.valueOf(dstIP.getValue());
+ String srcIpToQuery = srcIP.stringValue();
+ String destIpToQuery = dstIP.stringValue();
synchronized ((vpnName + srcIpToQuery).intern()) {
vpnUtil.createLearntVpnVipToPortEvent(vpnName, srcIpToQuery, destIpToQuery, srcInterface,
srcMac.getValue(), LearntVpnVipToPortEventAction.Add, null);
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
-
import javax.inject.Inject;
import javax.inject.Singleton;
-
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.genius.arputil.api.ArpConstants;
import org.opendaylight.genius.interfacemanager.interfaces.IInterfaceManager;
import org.opendaylight.netvirt.neutronvpn.interfaces.INeutronVpnManager;
import org.opendaylight.netvirt.vpnmanager.VpnUtil;
import org.opendaylight.netvirt.vpnmanager.iplearn.model.MacEntry;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IetfInetUtil;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.PhysAddress;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.alivenessmonitor.rev160411.AlivenessMonitorService;
return;
}
- final IpAddress targetIp = new IpAddress(macEntry.getIpAddress().getHostAddress().toCharArray());
+ final IpAddress targetIp = IetfInetUtil.INSTANCE.ipAddressFor(macEntry.getIpAddress());
if (ipMonitorProfileId == null || ipMonitorProfileId.equals(0L)) {
Optional<Long> profileIdOptional = allocateIpMonitorProfile(targetIp);
if (!profileIdOptional.isPresent()) {
LOG.info(
"ArpNotification Non-Gratuitous Request Received from "
+ "interface {} and IP {} having MAC {} target destination {}, ignoring..",
- srcInterface, String.valueOf(srcIP.getValue()), srcMac.getValue(),
- String.valueOf(targetIP.getValue()));
+ srcInterface, srcIP.stringValue(), srcMac.getValue(), targetIP.stringValue());
return;
}
LOG.info(
"ArpNotification Gratuitous Request Received from interface {} and IP {} having MAC {} "
+ "target destination {}, learning MAC",
- srcInterface, String.valueOf(srcIP.getValue()), srcMac.getValue(), String.valueOf(targetIP.getValue()));
+ srcInterface, srcIP.stringValue(), srcMac.getValue(), targetIP.stringValue());
processIpLearning(srcInterface, srcIP, srcMac, metadata, targetIP);
}
BigInteger metadata = notification.getMetadata();
IpAddress targetIP = notification.getDstIpaddress();
LOG.info("ArpNotification Response Received from interface {} and IP {} having MAC {}, learning MAC",
- srcInterface, String.valueOf(srcIP.getValue()), srcMac.getValue());
+ srcInterface, srcIP.stringValue(), srcMac.getValue());
validateAndProcessIpLearning(srcInterface, srcIP, srcMac, targetIP, metadata);
}
IpAddress targetIP = new IpAddress(naPacket.getTargetAddress());
BigInteger metadata = naPacket.getMetadata();
LOG.debug("NA notification received from interface {} and IP {} having MAC {}, targetIP={}", srcInterface,
- String.valueOf(srcIP.getValue()), srcMac.getValue(), String.valueOf(targetIP.getValue()));
+ srcIP.stringValue(), srcMac.getValue(), targetIP.stringValue());
validateAndProcessIpLearning(srcInterface, srcIP, srcMac, targetIP, metadata);
}