本文整理汇总了Java中org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressBuilder类的典型用法代码示例。如果您正苦于以下问题:Java IpAddressBuilder类的具体用法?Java IpAddressBuilder怎么用?Java IpAddressBuilder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IpAddressBuilder类属于org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715包,在下文中一共展示了IpAddressBuilder类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getSourceIpAddress
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressBuilder; //导入依赖的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;
}
开发者ID:opendaylight,项目名称:netvirt,代码行数:19,代码来源:ElanUtils.java
示例2: testCreateConnectionInfo
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressBuilder; //导入依赖的package包/类
@Test
public void testCreateConnectionInfo() throws Exception {
OvsdbClient client = mock(OvsdbClient.class, Mockito.RETURNS_DEEP_STUBS);
InetAddress remoteAddress = InetAddress.getByAddress(new byte[] {1, 2, 3, 4});
when(client.getConnectionInfo().getRemoteAddress()).thenReturn(remoteAddress);
when(client.getConnectionInfo().getRemotePort()).thenReturn(8080);
InetAddress localAddress = InetAddress.getByAddress(new byte[] {1, 2, 3, 5});
when(client.getConnectionInfo().getLocalAddress()).thenReturn(localAddress);
when(client.getConnectionInfo().getLocalPort()).thenReturn(8081);
ConnectionInfo returnedConnectionInfo = SouthboundMapper.createConnectionInfo(client);
assertEquals(IpAddressBuilder.getDefaultInstance("1.2.3.4"), returnedConnectionInfo.getRemoteIp());
assertEquals(8080, (int) returnedConnectionInfo.getRemotePort().getValue());
assertEquals(IpAddressBuilder.getDefaultInstance("1.2.3.5"), returnedConnectionInfo.getLocalIp());
assertEquals(8081, (int) returnedConnectionInfo.getLocalPort().getValue());
}
开发者ID:opendaylight,项目名称:ovsdb,代码行数:18,代码来源:SouthboundMapperTest.java
示例3: getDefaultInstance
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressBuilder; //导入依赖的package包/类
public static IpPrefixOrAddress getDefaultInstance(String defaultValue) {
try {
IpPrefix ipPrefix = IpPrefixBuilder.getDefaultInstance(defaultValue);
return new IpPrefixOrAddress(ipPrefix);
} catch (IllegalArgumentException e) {
LOG.debug("{} is not of IpPrefix type; checking whether it's a IpAddress type", defaultValue);
IpAddress ipAddress = IpAddressBuilder.getDefaultInstance(defaultValue);
return new IpPrefixOrAddress(ipAddress);
}
}
开发者ID:opendaylight,项目名称:netvirt,代码行数:11,代码来源:IpPrefixOrAddressBuilder.java
示例4: getDefaultInstance
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressBuilder; //导入依赖的package包/类
public static IpPrefixOrAddress getDefaultInstance(final java.lang.String defaultValue) {
try {
IpPrefix ipPrefix = IpPrefixBuilder.getDefaultInstance(defaultValue);
return new IpPrefixOrAddress(ipPrefix);
} catch (IllegalArgumentException e) {
IpAddress ipAddress = IpAddressBuilder.getDefaultInstance(defaultValue);
return new IpPrefixOrAddress(ipAddress);
}
}
开发者ID:opendaylight,项目名称:neutron,代码行数:10,代码来源:IpPrefixOrAddressBuilder.java
示例5: getDefaultInstance
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressBuilder; //导入依赖的package包/类
public static NextHop getDefaultInstance(final String defaultValue) {
try {
final LocalDefinedNextHop nextHopEnum = LocalDefinedNextHop.valueOf(defaultValue.toUpperCase());
return new NextHop(nextHopEnum);
} catch (final IllegalArgumentException e) {
try {
final IpAddress ipAddress = IpAddressBuilder.getDefaultInstance(defaultValue);
return new NextHop(ipAddress);
} catch (final IllegalArgumentException e1) {
return new NextHop(defaultValue);
}
}
}
开发者ID:opendaylight,项目名称:bgpcep,代码行数:14,代码来源:LocalStaticConfigNextHopBuilder.java
示例6: getDefaultInstance
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressBuilder; //导入依赖的package包/类
public static BgpNextHopType getDefaultInstance(final java.lang.String defaultValue) {
try {
final Enumeration nextHopEnum = BgpNextHopType.Enumeration.valueOf(defaultValue.toUpperCase());
return new BgpNextHopType(nextHopEnum);
} catch (final IllegalArgumentException e) {
try {
final IpAddress ipAddress = IpAddressBuilder.getDefaultInstance(defaultValue);
return new BgpNextHopType(ipAddress);
} catch (final IllegalArgumentException e1) {
throw new IllegalArgumentException("Cannot create BgpNextHopType from " + defaultValue);
}
}
}
开发者ID:opendaylight,项目名称:bgpcep,代码行数:14,代码来源:BgpNextHopTypeBuilder.java
示例7: getDefaultInstance
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressBuilder; //导入依赖的package包/类
public static LocalAddress getDefaultInstance(final java.lang.String defaultValue) {
try {
final IpAddress ipAddress = IpAddressBuilder.getDefaultInstance(defaultValue);
return new LocalAddress(ipAddress);
} catch (final IllegalArgumentException e) {
return new LocalAddress(defaultValue);
}
}
开发者ID:opendaylight,项目名称:bgpcep,代码行数:9,代码来源:BgpNeighborTransportConfigLocalAddressBuilder.java
示例8: testCreateInetAddress
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressBuilder; //导入依赖的package包/类
@Test
public void testCreateInetAddress() throws Exception {
// IPv4 address
IpAddress ipV4Address = IpAddressBuilder.getDefaultInstance("99.99.99.99");
assertEquals("Incorrect InetAddress received", InetAddress.getByAddress(new byte[] {99, 99, 99, 99}),
SouthboundMapper.createInetAddress(ipV4Address));
// IPv6 address
IpAddress ipV6Address = IpAddressBuilder.getDefaultInstance("0000:0000:0000:0000:0000:9999:FE1E:8329");
assertEquals("Incorrect InetAddress received", InetAddress.getByAddress(
new byte[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, (byte) 0x99, (byte) 0x99, (byte) 0xFE, 0x1E, (byte) 0x83,
0x29 }),
SouthboundMapper.createInetAddress(ipV6Address));
}
开发者ID:opendaylight,项目名称:ovsdb,代码行数:15,代码来源:SouthboundMapperTest.java
示例9: testSuppressLocalIpPort
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressBuilder; //导入依赖的package包/类
@Test
public void testSuppressLocalIpPort() throws Exception {
ConnectionInfo connectionInfo = mock(ConnectionInfo.class);
IpAddress ipAddress = IpAddressBuilder.getDefaultInstance("1.2.3.4");
when(connectionInfo.getRemoteIp()).thenReturn(ipAddress);
PortNumber portNumber = PortNumber.getDefaultInstance("8080");
when(connectionInfo.getRemotePort()).thenReturn(portNumber);
ConnectionInfo returnedConnectionInfo = SouthboundMapper.suppressLocalIpPort(connectionInfo);
assertEquals(ipAddress, returnedConnectionInfo.getRemoteIp());
assertEquals(portNumber, returnedConnectionInfo.getRemotePort());
assertNull(returnedConnectionInfo.getLocalIp());
assertNull(returnedConnectionInfo.getLocalPort());
}
开发者ID:opendaylight,项目名称:ovsdb,代码行数:14,代码来源:SouthboundMapperTest.java
示例10: setupMocks
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressBuilder; //导入依赖的package包/类
private void setupMocks() {
nexthopIp = "10.1.1.25";
idKey = "100:1.10.1.1.24";
poolName = "vpnservices";
elanTag = 2L;
longId = Long.valueOf("100");
nodeConnectorId = buildNodeConnectorId(dpId, 2L);
ipAddress = IpAddressBuilder.getDefaultInstance(nexthopIp);
vpnIntfaces = new VpnInterfacesBuilder().setInterfaceName(interfaceName).setKey(
new VpnInterfacesKey(interfaceName)).build();
List<VpnInterfaces> vpnInterfaces = new ArrayList<>();
final List<SubnetToDpn> subToDpn = new ArrayList<>();
final List<Uuid> portList = new ArrayList<>();
final List<PortOpDataEntry> listPortOpDataEntry = new ArrayList<>();
final List<TunnelEndPoints> tunnelEndPoints = new ArrayList<>();
List<Uuid> subnetIdList = new ArrayList<>();
subnetIdList.add(subnetId);
vpnInterfaces.add(vpnIntfaces);
lowerLayerIfList.add(nodeConnectorId.getValue());
portOp = new PortOpDataEntryBuilder().setDpnId(dpId).setKey(new PortOpDataEntryKey(tenantId.getValue()))
.setSubnetIds(subnetIdList).setPortId(tenantId.getValue()).build();
subnetToDpn = new SubnetToDpnBuilder().setDpnId(dpId).setKey(new SubnetToDpnKey(dpId)).setVpnInterfaces(
vpnInterfaces).build();
allocateIdOutput = new AllocateIdOutputBuilder().setIdValue(longId).build();
allocateIdInput = new AllocateIdInputBuilder().setPoolName(poolName).setIdKey(idKey).build();
subToDpn.add(subnetToDpn);
portList.add(portId);
listPortOpDataEntry.add(portOp);
org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.state
.InterfaceBuilder ifaceBuilder = new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf
.interfaces.rev140508.interfaces.state.InterfaceBuilder();
ifaceBuilder.setLowerLayerIf(lowerLayerIfList).setType(L2vlan.class)
.setAdminStatus(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508
.interfaces.state.Interface.AdminStatus.Up).setOperStatus(Interface.OperStatus.Up)
.setIfIndex(100).setKey(new InterfaceKey(interfaceName)).setName(interfaceName)
.setPhysAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715
.PhysAddress.getDefaultInstance("AA:AA:AA:AA:AA:AA"));
stateInterface = ifaceBuilder.build();
subnetOp = new SubnetOpDataEntryBuilder().setElanTag(elanTag).setNhDpnId(dpId).setSubnetCidr(subnetIp)
.setSubnetId(subnetId).setKey(new SubnetOpDataEntryKey(subnetId)).setVpnName(interfaceName)
.setVrfId(primaryRd).setSubnetToDpn(subToDpn).setRouteAdvState(TaskState.Advertised).build();
vpnInstance = new VpnInstanceBuilder().setVpnId(elanTag).setVpnInstanceName(interfaceName)
.setVrfId(interfaceName).setKey(new VpnInstanceKey(interfaceName)).build();
subnetmap = new SubnetmapBuilder().setSubnetIp(subnetIp).setId(subnetId).setNetworkId(portId).setKey(new
SubnetmapKey(subnetId)).setRouterId(portId).setVpnId(subnetId)
.setTenantId(tenantId).setPortList(portList).build();
portOpData = new PortOpDataBuilder().setPortOpDataEntry(listPortOpDataEntry).build();
dpntePsInfo = new DPNTEPsInfoBuilder().setDPNID(dpId).setUp(true).setKey(new DPNTEPsInfoKey(dpId))
.setTunnelEndPoints(tunnelEndPoints).build();
tunlEndPts =
new TunnelEndPointsBuilder().setInterfaceName(interfaceName).setVLANID(10).setIpAddress(ipAddress).build();
tunnelEndPoints.add(tunlEndPts);
ipv4Family = new Ipv4FamilyBuilder().setRouteDistinguisher(routeDistinguishers).build();
vpnInstnce = new org.opendaylight.yang.gen.v1.urn.huawei.params.xml.ns.yang.l3vpn.rev140815.vpn.instances
.VpnInstanceBuilder().setKey(new org.opendaylight.yang.gen.v1.urn.huawei.params.xml.ns.yang.l3vpn
.rev140815.vpn.instances.VpnInstanceKey(interfaceName)).setVpnInstanceName(interfaceName)
.setIpv4Family(ipv4Family).build();
networks = new NetworksBuilder().setId(portId).setKey(new NetworksKey(portId)).build();
doReturn(mockReadTx).when(dataBroker).newReadOnlyTransaction();
doReturn(mockWriteTx).when(dataBroker).newWriteOnlyTransaction();
doReturn(Futures.immediateCheckedFuture(null)).when(mockWriteTx).submit();
}
开发者ID:opendaylight,项目名称:netvirt,代码行数:64,代码来源:VpnSubnetRouteHandlerTest.java
示例11: onSessionUp
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressBuilder; //导入依赖的package包/类
@Override
public final synchronized void onSessionUp(final PCEPSession psession) {
/*
* The session went up. Look up the router in Inventory model,
* create it if it is not there (marking that fact for later
* deletion), and mark it as synchronizing. Also create it in
* the topology model, with empty LSP list.
*/
final InetAddress peerAddress = psession.getRemoteAddress();
this.syncOptimization = new SyncOptimization(psession);
final TopologyNodeState state = this.serverSessionManager.takeNodeState(peerAddress,
this, isLspDbRetreived());
// takeNodeState(..) may fail when the server session manager is being restarted due to configuration change
if (state == null) {
LOG.error("Unable to fetch topology node state for PCEP session. Closing session {}", psession);
psession.close(TerminationReason.UNKNOWN);
this.onSessionTerminated(psession, new PCEPCloseTermination(TerminationReason.UNKNOWN));
return;
}
if (this.session != null || this.nodeState != null) {
LOG.error("PCEP session is already up with {}. Closing session {}", psession.getRemoteAddress(), psession);
psession.close(TerminationReason.UNKNOWN);
this.onSessionTerminated(psession, new PCEPCloseTermination(TerminationReason.UNKNOWN));
return;
}
this.session = psession;
this.nodeState = state;
this.serverSessionManager.bind(this.nodeState.getNodeId(), this.listenerState);
LOG.trace("Peer {} resolved to topology node {}", peerAddress, state.getNodeId());
// Our augmentation in the topology node
final PathComputationClientBuilder pccBuilder = new PathComputationClientBuilder();
onSessionUp(psession, pccBuilder);
this.synced.set(isSynchronized());
pccBuilder.setIpAddress(IpAddressBuilder.getDefaultInstance(peerAddress.getHostAddress()));
final InstanceIdentifier<Node1> topologyAugment = state.getNodeId().augmentation(Node1.class);
this.pccIdentifier = topologyAugment.child(PathComputationClient.class);
final Node initialNodeState = state.getInitialNodeState();
final boolean isNodePresent = isLspDbRetreived() && initialNodeState != null;
if (isNodePresent) {
loadLspData(initialNodeState, this.lspData, this.lsps, isIncrementalSynchro());
pccBuilder.setReportedLsp(initialNodeState.getAugmentation(Node1.class)
.getPathComputationClient().getReportedLsp());
}
state.storeNode(topologyAugment,
new Node1Builder().setPathComputationClient(pccBuilder.build()).build(), this.session);
this.listenerState.init(psession);
LOG.info("Session with {} attached to topology node {}", psession.getRemoteAddress(), state.getNodeId());
}
开发者ID:opendaylight,项目名称:bgpcep,代码行数:57,代码来源:AbstractTopologySessionListener.java
示例12: extractOrigRouteIp
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressBuilder; //导入依赖的package包/类
static IpAddress extractOrigRouteIp(final DataContainerNode<? extends PathArgument> evpn) {
return IpAddressBuilder.getDefaultInstance((String) evpn.getChild(ORI_NID).get().getValue());
}
开发者ID:opendaylight,项目名称:bgpcep,代码行数:4,代码来源:NlriModelUtil.java
示例13: extractIp
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressBuilder; //导入依赖的package包/类
static IpAddress extractIp(final DataContainerNode<? extends PathArgument> evpn) {
if (evpn.getChild(IP_NID).isPresent()) {
return IpAddressBuilder.getDefaultInstance((String) evpn.getChild(IP_NID).get().getValue());
}
return null;
}
开发者ID:opendaylight,项目名称:bgpcep,代码行数:7,代码来源:NlriModelUtil.java
示例14: testCreateIpAddress
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressBuilder; //导入依赖的package包/类
@Test
public void testCreateIpAddress() throws Exception {
IpAddress ipAddress = IpAddressBuilder.getDefaultInstance("127.0.0.1");
InetAddress inetAddress = InetAddress.getByAddress(new byte[] {127, 0, 0, 1});
assertEquals("Incorrect IP address created", ipAddress, SouthboundMapper.createIpAddress(inetAddress));
}
开发者ID:opendaylight,项目名称:ovsdb,代码行数:7,代码来源:SouthboundMapperTest.java
注:本文中的org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressBuilder类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论