本文整理汇总了Java中org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress类的典型用法代码示例。如果您正苦于以下问题:Java IpAddress类的具体用法?Java IpAddress怎么用?Java IpAddress使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IpAddress类属于org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715包,在下文中一共展示了IpAddress类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildArpIpMatches
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress; //导入依赖的package包/类
/**
* Builds the arp ip matches.
* @param ipPrefixOrAddress the ip prefix or address
* @return the MatchInfoBase list
*/
public static List<MatchInfoBase> buildArpIpMatches(IpPrefixOrAddress ipPrefixOrAddress) {
List<MatchInfoBase> flowMatches = new ArrayList<>();
IpPrefix ipPrefix = ipPrefixOrAddress.getIpPrefix();
if (ipPrefix != null) {
Ipv4Prefix ipv4Prefix = ipPrefix.getIpv4Prefix();
if (ipv4Prefix != null && !ipv4Prefix.getValue().equals(AclConstants.IPV4_ALL_NETWORK)) {
flowMatches.add(new MatchArpSpa(ipv4Prefix));
}
} else {
IpAddress ipAddress = ipPrefixOrAddress.getIpAddress();
if (ipAddress != null && ipAddress.getIpv4Address() != null) {
flowMatches.add(new MatchArpSpa(ipAddress.getIpv4Address().getValue(), "32"));
}
}
return flowMatches;
}
示例2: setPortDscpMarking
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress; //导入依赖的package包/类
public void setPortDscpMarking(Port port, DscpmarkingRules dscpMark) {
if (!qosEosHandler.isQosClusterOwner()) {
LOG.trace("Not Qos Cluster Owner. Ignoring setting DSCP marking");
return;
}
LOG.trace("Setting DSCP value {} on Port {}", port, dscpMark);
BigInteger dpnId = getDpnForInterface(port.getUuid().getValue());
String ifName = port.getUuid().getValue();
IpAddress ipAddress = port.getFixedIps().get(0).getIpAddress();
Short dscpValue = dscpMark.getDscpMark();
if (dpnId.equals(BigInteger.ZERO)) {
LOG.info("DPN ID for interface {} not found", port.getUuid().getValue());
return;
}
//1. OF rules
addFlow(dpnId, dscpValue, ifName, ipAddress, getInterfaceStateFromOperDS(ifName));
if (qosServiceConfiguredPorts.add(port.getUuid())) {
// bind qos service to interface
bindservice(ifName);
}
}
示例3: getNeutronPortForIp
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress; //导入依赖的package包/类
public static Port getNeutronPortForIp(DataBroker broker,
IpAddress targetIP, String deviceType) {
List<Port> ports = getNeutronPorts(
broker);
for (Port port : ports) {
if (deviceType.equals(port.getDeviceOwner()) && port.getFixedIps() != null) {
for (FixedIps ip : port.getFixedIps()) {
if (Objects.equals(ip.getIpAddress(), targetIP)) {
return port;
}
}
}
}
LOG.error("getNeutronPortForIp : Neutron Port missing for IP:{} DeviceType:{}", targetIP, deviceType);
return null;
}
示例4: updateTunnelToUnderlayNetworkOperDs
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress; //导入依赖的package包/类
private void updateTunnelToUnderlayNetworkOperDs(StateTunnelList tunnelState, boolean isAdded) {
BigInteger srcDpId = getTepDpnId(tunnelState.getSrcInfo());
BigInteger dstDpId = getTepDpnId(tunnelState.getDstInfo());
String tunnelInterfaceName = tunnelState.getTunnelInterfaceName();
if (BigInteger.ZERO.equals(srcDpId) || BigInteger.ZERO.equals(dstDpId)) {
LOG.warn("No valid DPN found for tunnel {}", tunnelInterfaceName);
return;
}
IpAddress tunnelIp = getTunnelIp(tunnelState);
if (tunnelIp == null) {
LOG.warn("No tunnel ip found for tunnel {} DPN {}", tunnelInterfaceName, srcDpId);
return;
}
String underlayNetwork = policyServiceUtil.getTunnelUnderlayNetwork(srcDpId, tunnelIp);
if (underlayNetwork == null) {
LOG.debug("No underlay networks defined for tunnel {} DPN {}", tunnelInterfaceName, srcDpId);
return;
}
LOG.info("Handle tunnel state update for interface {} on DPN {} underlay network {}", tunnelInterfaceName,
srcDpId, underlayNetwork);
policyServiceUtil.updateTunnelInterfaceForUnderlayNetwork(underlayNetwork, srcDpId, dstDpId,
tunnelInterfaceName, isAdded);
}
示例5: getTunnelInterfaceName
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress; //导入依赖的package包/类
protected String getTunnelInterfaceName(BigInteger srcDpId, org.opendaylight.yang.gen.v1.urn.ietf.params
.xml.ns.yang.ietf.inet.types.rev130715.IpAddress dstIp) {
Class<? extends TunnelTypeBase> tunType = getReqTunType(getReqTransType().toUpperCase(Locale.getDefault()));
Future<RpcResult<GetInternalOrExternalInterfaceNameOutput>> result;
try {
result = itmManager.getInternalOrExternalInterfaceName(new GetInternalOrExternalInterfaceNameInputBuilder()
.setSourceDpid(srcDpId)
.setDestinationIp(dstIp)
.setTunnelType(tunType)
.build());
RpcResult<GetInternalOrExternalInterfaceNameOutput> rpcResult = result.get();
if (!rpcResult.isSuccessful()) {
LOG.warn("RPC Call to getTunnelInterfaceName returned with Errors {}", rpcResult.getErrors());
} else {
return rpcResult.getResult().getInterfaceName();
}
} catch (InterruptedException | ExecutionException e) {
LOG.warn("Exception when getting tunnel interface Id for tunnel between {} and {}", srcDpId, dstIp, e);
}
return null;
}
示例6: buildBucketForDcGwLbGroup
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress; //导入依赖的package包/类
private Bucket buildBucketForDcGwLbGroup(String ipAddress, BigInteger dpnId,
int index) {
List<Action> listAction = new ArrayList<>();
// ActionKey 0 goes to mpls label.
int actionKey = 1;
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()));
List<Action> egressActions = getEgressActions(tunnelInterfaceName, actionKey++);
if (!egressActions.isEmpty()) {
listAction.addAll(getEgressActions(tunnelInterfaceName, actionKey++));
} else {
// clear off actions if there is no egress actions.
listAction = Collections.emptyList();
}
return MDSALUtil.buildBucket(listAction, MDSALUtil.GROUP_WEIGHT, index,
MDSALUtil.WATCH_PORT, MDSALUtil.WATCH_GROUP);
}
示例7: getEndpointIpForDpn
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress; //导入依赖的package包/类
@Override
public Future<RpcResult<GetEndpointIpForDpnOutput>> getEndpointIpForDpn(GetEndpointIpForDpnInput input) {
BigInteger dpnId = input.getDpid();
// if the dpnId is DPN_ID_NO_EXIST, then an empty response will be returned
GetEndpointIpForDpnOutputBuilder builder = new GetEndpointIpForDpnOutputBuilder();
if (dpnId == GeniusProviderTestParams.DPN_ID) {
List<IpAddress> localIpList = new ArrayList<>();
localIpList.add(new IpAddress(new Ipv4Address(GeniusProviderTestParams.IPV4_ADDRESS_STR)));
builder.setLocalIps(localIpList);
} else if (dpnId == GeniusProviderTestParams.DPN_ID_INVALID) {
return Futures.immediateFuture(RpcResultBuilder.<GetEndpointIpForDpnOutput>failed()
.withError(ErrorType.APPLICATION, "Invalid data.").build());
}
return Futures.immediateFuture(RpcResultBuilder
.<GetEndpointIpForDpnOutput>success(builder.build()).build());
}
示例8: onArpRequestReceived
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress; //导入依赖的package包/类
@Override
public void onArpRequestReceived(ArpRequestReceived notification) {
String srcInterface = notification.getInterface();
IpAddress srcIP = notification.getSrcIpaddress();
PhysAddress srcMac = notification.getSrcMac();
IpAddress targetIP = notification.getDstIpaddress();
BigInteger metadata = notification.getMetadata();
boolean isGarp = srcIP.equals(targetIP);
if (!isGarp) {
LOG.info("ArpNotification Non-Gratuitous Request Received from "
+ "interface {} and IP {} having MAC {} target destination {}, ignoring..",
srcInterface, srcIP.getIpv4Address().getValue(),srcMac.getValue(),
targetIP.getIpv4Address().getValue());
return;
}
LOG.info("ArpNotification Gratuitous Request Received from "
+ "interface {} and IP {} having MAC {} target destination {}, learning MAC",
srcInterface, srcIP.getIpv4Address().getValue(),srcMac.getValue(),
targetIP.getIpv4Address().getValue());
processArpLearning(srcInterface, srcIP, srcMac, metadata, targetIP);
}
示例9: onArpResponseReceived
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress; //导入依赖的package包/类
@Override
public void onArpResponseReceived(ArpResponseReceived notification) {
String srcInterface = notification.getInterface();
IpAddress srcIP = notification.getSrcIpaddress();
PhysAddress srcMac = notification.getSrcMac();
LOG.info("ArpNotification Response Received from interface {} and IP {} having MAC {}, learning MAC",
srcInterface, srcIP.getIpv4Address().getValue(), srcMac.getValue());
List<Adjacency> adjacencies = VpnUtil.getAdjacenciesForVpnInterfaceFromConfig(dataBroker, srcInterface);
if (adjacencies != null) {
for (Adjacency adj : adjacencies) {
String ipAddress = adj.getIpAddress();
try {
if (NWUtil.isIpInSubnet(NWUtil.ipAddressToInt(srcIP.getIpv4Address().getValue()), ipAddress)) {
return;
}
} catch (UnknownHostException e) {
LOG.error("Subnet string {} not convertible to InetAdddress", srcIP, e);
}
}
}
BigInteger metadata = notification.getMetadata();
IpAddress targetIP = notification.getDstIpaddress();
LOG.trace("ArpNotification Response Received from interface {} and IP {} having MAC {}, learning MAC",
srcInterface, srcIP.getIpv4Address().getValue(), srcMac.getValue());
processArpLearning(srcInterface, srcIP, srcMac, metadata, targetIP);
}
示例10: addPsNode
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress; //导入依赖的package包/类
CheckedFuture<Void, TransactionCommitFailedException> addPsNode(InstanceIdentifier<Node> path,
InstanceIdentifier<Node> parentPath, List<String> portNameList, WriteTransaction transaction)
throws Exception {
NodeBuilder nodeBuilder = null;
nodeBuilder = prepareOperationalNode(path);
PhysicalSwitchAugmentationBuilder physicalSwitchAugmentationBuilder = new PhysicalSwitchAugmentationBuilder();
physicalSwitchAugmentationBuilder.setManagedBy(new HwvtepGlobalRef(parentPath));
physicalSwitchAugmentationBuilder.setPhysicalSwitchUuid(getUUid("d1s3"));
physicalSwitchAugmentationBuilder.setHwvtepNodeName(new HwvtepNodeName("s3"));
physicalSwitchAugmentationBuilder.setHwvtepNodeDescription("description");
List<TunnelIps> tunnelIps = new ArrayList<>();
IpAddress ip = new IpAddress("192.168.122.30".toCharArray());
tunnelIps.add(new TunnelIpsBuilder().setKey(new TunnelIpsKey(ip)).setTunnelIpsKey(ip).build());
physicalSwitchAugmentationBuilder.setTunnelIps(tunnelIps);
nodeBuilder.addAugmentation(PhysicalSwitchAugmentation.class, physicalSwitchAugmentationBuilder.build());
PhysicalSwitchHelper.dId = parentPath;
nodeBuilder.setTerminationPoint(PhysicalSwitchHelper
.addPhysicalSwitchTerminationPoints(path, transaction, portNameList));
return TestUtil.submitNode(OPERATIONAL, path, nodeBuilder.build(), transaction);
}
示例11: getGatewayIpAddressFromInterface
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress; //导入依赖的package包/类
static Optional<IpAddress> getGatewayIpAddressFromInterface(String srcInterface,
INeutronVpnManager neutronVpnService, DataBroker dataBroker) {
Optional<IpAddress> gatewayIp = Optional.absent();
if (neutronVpnService != null) {
//TODO(Gobinath): Need to fix this as assuming port will belong to only one Subnet would be incorrect"
Port port = neutronVpnService.getNeutronPort(srcInterface);
if (port != null && port.getFixedIps() != null && port.getFixedIps().get(0) != null
&& port.getFixedIps().get(0).getSubnetId() != null) {
gatewayIp = Optional.of(
neutronVpnService.getNeutronSubnet(port.getFixedIps().get(0).getSubnetId()).getGatewayIp());
}
} else {
LOG.error("getGatewayIpAddressFromInterface: neutron vpn service is not configured."
+ " Failed for interface {}.", srcInterface);
}
return gatewayIp;
}
示例12: getSourceDpnTepIp
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress; //导入依赖的package包/类
/**
* Gets the source dpn tep ip.
*
* @param srcDpnId
* the src dpn id
* @param dstHwVtepNodeId
* the dst hw vtep node id
* @return the dpn tep ip
*/
public IpAddress getSourceDpnTepIp(BigInteger srcDpnId,
org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId dstHwVtepNodeId) {
IpAddress dpnTepIp = null;
String tunnelInterfaceName = getExternalTunnelInterfaceName(String.valueOf(srcDpnId),
dstHwVtepNodeId.getValue());
if (tunnelInterfaceName != null) {
Interface tunnelInterface =
ElanL2GatewayUtils.getInterfaceFromConfigDS(new InterfaceKey(tunnelInterfaceName), broker);
if (tunnelInterface != null) {
dpnTepIp = tunnelInterface.getAugmentation(IfTunnel.class).getTunnelSource();
} else {
LOG.warn("Tunnel interface not found for tunnelInterfaceName {}", tunnelInterfaceName);
}
} else {
LOG.warn("Tunnel interface name not found for srcDpnId {} and dstHwVtepNodeId {}", srcDpnId,
dstHwVtepNodeId);
}
return dpnTepIp;
}
示例13: remove
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress; //导入依赖的package包/类
@Override
protected void remove(InstanceIdentifier<LocalUcastMacs> identifier,
LocalUcastMacs del) {
// Flow removal for table 18 is handled in Neutron Port delete.
//remove the new CR-DHCP
NodeId torNodeId = identifier.firstKeyOf(Node.class).getNodeId();
LogicalSwitches logicalSwitch = getLogicalSwitches(del);
if (null == logicalSwitch) {
LOG.error("DhcpUCastMacListener remove :Logical Switch ref doesn't have data");
return;
}
String elanInstanceName = logicalSwitch.getHwvtepNodeName().getValue();
L2GatewayDevice device = ElanL2GwCacheUtils.getL2GatewayDeviceFromCache(elanInstanceName, torNodeId.getValue());
if (device == null) {
LOG.error("Logical Switch Device with name {} is not present in L2GWCONN cache", elanInstanceName);
return;
}
IpAddress tunnelIp = device.getTunnelIp();
Pair<IpAddress, String> tunnelIpElanName = new ImmutablePair<>(tunnelIp, elanInstanceName);
dhcpExternalTunnelManager.removeFromAvailableCache(tunnelIpElanName);
}
示例14: remove
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress; //导入依赖的package包/类
@Override
protected void remove(InstanceIdentifier<Interface> identifier, Interface del) {
jobCoordinator.enqueueJob(DhcpServiceUtils.getJobKey(del.getName()), () -> {
IfTunnel tunnelInterface = del.getAugmentation(IfTunnel.class);
IfL2vlan vlanInterface = del.getAugmentation(IfL2vlan.class);
String interfaceName = del.getName();
if (tunnelInterface != null && !tunnelInterface.isInternal()) {
IpAddress tunnelIp = tunnelInterface.getTunnelDestination();
ParentRefs interfce = del.getAugmentation(ParentRefs.class);
if (interfce != null) {
if (LOG.isTraceEnabled()) {
LOG.trace("Calling handleTunnelStateDown for tunnelIp {} and interface {}",
tunnelIp, interfaceName);
}
return dhcpExternalTunnelManager.handleTunnelStateDown(tunnelIp,
interfce.getDatapathNodeIdentifier());
}
}
if (vlanInterface != null) {
WriteTransaction unbindTx = dataBroker.newWriteOnlyTransaction();
DhcpServiceUtils.unbindDhcpService(interfaceName, unbindTx);
return Collections.singletonList(unbindTx.submit());
}
return Collections.emptyList();
}, DhcpMConstants.RETRY_COUNT);
}
示例15: getSourceIpAddress
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress; //导入依赖的package包/类
public Optional<IpAddress> getSourceIpAddress(Ethernet ethernet) {
Optional<IpAddress> srcIpAddress = Optional.absent();
if (ethernet.getPayload() == null) {
return srcIpAddress;
}
byte[] ipAddrBytes = null;
if (ethernet.getPayload() instanceof IPv4) {
IPv4 ipv4 = (IPv4) ethernet.getPayload();
ipAddrBytes = Ints.toByteArray(ipv4.getSourceAddress());
} else if (ethernet.getPayload() instanceof ARP) {
ipAddrBytes = ((ARP) ethernet.getPayload()).getSenderProtocolAddress();
}
if (ipAddrBytes != null) {
String ipAddr = NWUtil.toStringIpAddress(ipAddrBytes);
return Optional.of(IpAddressBuilder.getDefaultInstance(ipAddr));
}
return srcIpAddress;
}