本文整理汇总了Java中org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address类的典型用法代码示例。如果您正苦于以下问题:Java Ipv4Address类的具体用法?Java Ipv4Address怎么用?Java Ipv4Address使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Ipv4Address类属于org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715包,在下文中一共展示了Ipv4Address类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: create_session
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address; //导入依赖的package包/类
/**
* Creates Mobility Session
* @param dpn - DPN
* @param imsi - IMSI
* @param ue_ip - Session IP Address
* @param default_ebi - Default EBI
* @param s1u_sgw_gtpu_ipv4 - SGW GTP-U IPv4 Address
* @param s1u_sgw_gtpu_teid - SGW GTP-U TEID
* @param clientIdentifier - Client Identifier
* @param opIdentifier - Operation Identifier
* @param sessionId - Session Id
*/
public void create_session(
Short dpn,
BigInteger imsi,
Ipv4Address ue_ip,
Short default_ebi,
Ipv4Address s1u_sgw_gtpu_ipv4,
Long s1u_sgw_gtpu_teid, // Although this is intended to be a Uint32
Long clientIdentifier,
BigInteger opIdentifier,
Long sessionId
//UlTftTable ul_tft_table
)
{
create_session(dpn, imsi, IPToDecimal.ipv4ToLong(ue_ip.getValue()),
default_ebi, s1u_sgw_gtpu_ipv4, s1u_sgw_gtpu_teid, clientIdentifier, opIdentifier, sessionId);
}
开发者ID:opendaylight,项目名称:fpc,代码行数:29,代码来源:DpnAPI2.java
示例2: modify_bearer_dl
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address; //导入依赖的package包/类
/**
* Modify Downlink Bearer
* @param dpn - DPN
* @param s1u_sgw_gtpu_teid - SGW GTP-U TEID
* @param s1u_enb_gtpu_ipv4 - ENodeB GTP-U IPv4 Address
* @param s1u_enb_gtpu_teid - ENodeB GTP-U TEID
* @param clientIdentifier - Client Identifier
* @param opIdentifier - Operation Identifier
*/
public void modify_bearer_dl(
Short dpn,
Long s1u_sgw_gtpu_teid,
Ipv4Address s1u_enb_gtpu_ipv4,
Long s1u_enb_gtpu_teid,
Long clientIdentifier,
BigInteger opIdentifier
)
{
ByteBuffer bb = ByteBuffer.allocate(23);
bb.put(toUint8(dpn))
.put(MODIFY_DL_BEARER_TYPE)
.put(toUint32(IPToDecimal.ipv4ToLong(s1u_enb_gtpu_ipv4.getValue())))
.put(toUint32(s1u_enb_gtpu_teid))
.put(toUint32(s1u_sgw_gtpu_teid))
.put(toUint32(clientIdentifier))
.put(toUint32(opIdentifier.longValue()));
try {
sock.getBlockingQueue().put(bb);
} catch (InterruptedException e) {
ErrorLog.logError(e.getStackTrace());
};
}
开发者ID:opendaylight,项目名称:fpc,代码行数:33,代码来源:DpnAPI2.java
示例3: create_bearer_ul
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address; //导入依赖的package包/类
/**
* Create Uplink Bearer.
* @param dpn - DPN
* @param imsi - IMSI
* @param default_ebi - Default EBI
* @param dedicated_ebi - Dedicated EBI
* @param s1u_sgw_gtpu_ipv4 - SGW GTP-U IPv4 Address
* @param s1u_sgw_gtpu_teid - SGW GTP-U TEID
* @param ul_tft_table - Uplink TFT
*/
public void create_bearer_ul(
Short dpn,
BigInteger imsi,
Short default_ebi,
Short dedicated_ebi,
Ipv4Address s1u_sgw_gtpu_ipv4,
Long s1u_sgw_gtpu_teid,
Object ul_tft_table)
{
ByteBuffer bb = ByteBuffer.allocate(21);
bb.put(toUint8(dpn))
.put(CREATE_UL_BEARER_TYPE)
.put(toUint64(imsi))
.put(toUint8(default_ebi))
.put(toUint8(dedicated_ebi))
.put(toUint32(IPToDecimal.ipv4ToLong(s1u_sgw_gtpu_ipv4.getValue())))
.put(toUint32(s1u_sgw_gtpu_teid));
try {
sock.getBlockingQueue().put(bb);
} catch (InterruptedException e) {
ErrorLog.logError(e.getStackTrace());
};
}
开发者ID:opendaylight,项目名称:fpc,代码行数:35,代码来源:DpnAPI2.java
示例4: create_bearer_dl
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address; //导入依赖的package包/类
/**
* Create Downlink Bearer.
* @param dpn - DPN
* @param dedicated_ebi - Default EBI
* @param s1u_sgw_gtpu_teid - SGW GTP-U TEID
* @param s1u_enb_gtpu_ipv4 - ENodeB GTP-U IPv4 Address
* @param s1u_enb_gtpu_teid - ENodeB GTP-U TEID
*/
public void create_bearer_dl(
Short dpn,
Short dedicated_ebi,
Long s1u_sgw_gtpu_teid,
Ipv4Address s1u_enb_gtpu_ipv4,
Long s1u_enb_gtpu_teid)
//DlTft dl_tft_table)
{
ByteBuffer bb = ByteBuffer.allocate(16);
bb.put(toUint8(dpn))
.put(CREATE_DL_BEARER_TYPE)
.put(toUint8(dedicated_ebi))
.put(toUint32(s1u_sgw_gtpu_teid))
.put(toUint32(IPToDecimal.ipv4ToLong(s1u_enb_gtpu_ipv4.getValue())))
.put(toUint32(s1u_enb_gtpu_teid));
try {
sock.getBlockingQueue().put(bb);
} catch (InterruptedException e) {
ErrorLog.logError(e.getStackTrace());
};
}
开发者ID:opendaylight,项目名称:fpc,代码行数:31,代码来源:DpnAPI2.java
示例5: modify_bearer_ul
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address; //导入依赖的package包/类
/**
* Modify Uplink Bearer.
* @param dpn - DPN
* @param s1u_enb_gtpu_ipv4 - ENodeB GTP-U IPv4 Address
* @param s1u_enb_gtpu_teid - ENodeB GTP-U TEID
* @param s1u_sgw_gtpu_teid - SGW GTP-U TEID
* @param dl_tft_table - Downlink TFT
*/
public void modify_bearer_ul(
Short dpn,
Ipv4Address s1u_enb_gtpu_ipv4,
Long s1u_enb_gtpu_teid,
Long s1u_sgw_gtpu_teid,
Object dl_tft_table)
{
ByteBuffer bb = ByteBuffer.allocate(15);
bb.put(toUint8(dpn))
.put(MODIFY_UL_BEARER_TYPE)
.put(toUint32(IPToDecimal.ipv4ToLong(s1u_enb_gtpu_ipv4.getValue())))
.put(toUint32(s1u_enb_gtpu_teid))
.put(toUint32(s1u_sgw_gtpu_teid));
try {
sock.getBlockingQueue().put(bb);
} catch (InterruptedException e) {
ErrorLog.logError(e.getStackTrace());
};
}
开发者ID:opendaylight,项目名称:fpc,代码行数:29,代码来源:DpnAPI2.java
示例6: getEndpointIpForDpn
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address; //导入依赖的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());
}
开发者ID:opendaylight,项目名称:netvirt,代码行数:19,代码来源:TestOdlInterfaceRpcService.java
示例7: checkMatchTunDstIp
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address; //导入依赖的package包/类
private void checkMatchTunDstIp(Match match, Ipv4Address value) {
GeneralAugMatchNodesNodeTableFlow genAug =
match.getAugmentation(GeneralAugMatchNodesNodeTableFlow.class);
assertNotNull(genAug);
List<ExtensionList> extensions = genAug.getExtensionList();
for (ExtensionList extensionList : extensions) {
Extension extension = extensionList.getExtension();
NxAugMatchNodesNodeTableFlow nxAugMatch = extension.getAugmentation(NxAugMatchNodesNodeTableFlow.class);
if (nxAugMatch.getNxmNxTunIpv4Dst() != null) {
assertEquals(nxAugMatch.getNxmNxTunIpv4Dst().getIpv4Address(), value);
}
}
}
开发者ID:opendaylight,项目名称:netvirt,代码行数:17,代码来源:OpenFlow13ProviderTest.java
示例8: addElanInterface
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address; //导入依赖的package包/类
public void addElanInterface(String elanInstanceName, InterfaceInfo interfaceInfo, String prefix) {
ElanInstance existingElanInstance = elanInstanceManager.getElanInstanceByName(elanInstanceName);
String interfaceName = interfaceInfo.getInterfaceName();
if (existingElanInstance != null) {
ElanInterfaceBuilder elanInterfaceBuilder = new ElanInterfaceBuilder()
.setElanInstanceName(elanInstanceName)
.setName(interfaceName)
.setKey(new ElanInterfaceKey(interfaceName));
StaticMacEntriesBuilder staticMacEntriesBuilder = new StaticMacEntriesBuilder();
List<StaticMacEntries> staticMacEntries = new ArrayList<>();
List<PhysAddress> physAddressList = Collections.singletonList(
new PhysAddress(interfaceInfo.getMacAddress()));
for (PhysAddress physAddress : physAddressList) {
staticMacEntries.add(staticMacEntriesBuilder.setMacAddress(physAddress)
.setIpPrefix(new IpAddress(new Ipv4Address(prefix))).build());
}
elanInterfaceBuilder.setStaticMacEntries(staticMacEntries);
ElanInterface elanInterface = elanInterfaceBuilder.build();
MDSALUtil.syncWrite(dataBroker, LogicalDatastoreType.CONFIGURATION,
ElanUtils.getElanInterfaceConfigurationDataPathId(interfaceName), elanInterface);
}
}
开发者ID:opendaylight,项目名称:netvirt,代码行数:26,代码来源:ElanServiceTestBase.java
示例9: addIPMapping
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address; //导入依赖的package包/类
/**
* Set up IP mapping between external IP and internal IP address.
* @param fabricId - fabric identifier.
* @param ld - logical switch Id
* @param tpid - logical port id
* @param ext - external IP address
* @param internal - private IP address.
*/
public void addIPMapping(FabricId fabricId, NodeId ld, TpId tpid, Ipv4Address ext, Ipv4Address internal)
{
AddPortFunctionInputBuilder inputb = new AddPortFunctionInputBuilder();
inputb.setFabricId(fabricId);
inputb.setLogicalDevice(ld);
inputb.setLogicalPort(tpid);
PortFunctionBuilder pfb = new PortFunctionBuilder();
IpMappingBuilder ipmb = new IpMappingBuilder();
ipmb.setIpMappingEntry(
Lists.newArrayList(new IpMappingEntryBuilder()
.setExternalIp(ext)
.setInternalIp(internal)
.build()));
pfb.setFunctionType(ipmb.build());
inputb.setPortFunction(pfb.build());
this.fabServiceService.addPortFunction(inputb.build());
}
开发者ID:opendaylight,项目名称:faas,代码行数:30,代码来源:VContainerNetNodeServiceProvider.java
示例10: createBGPDataFlow
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address; //导入依赖的package包/类
public Map<Ipv4Address, BgpDataflow> createBGPDataFlow(final IntentIspPrefix intent) throws IntentInvalidException {
final EthernetService ethernetService = retrieveEthernetServiceBy(intent.getIspName());
final Map<Ipv4Address, BgpDataflow> bgpDataflowByPeerIp = Maps.newConcurrentMap();
retrieveRouterInfosByRouterGroup(ethernetService.getRouterGroupId().getValue()).forEach(routerInfo -> {
BgpDataflowBuilder dataflowBuilder = new BgpDataflowBuilder();
dataflowBuilder.setId(intent.getId());
dataflowBuilder.setOriginatorIp(Ipv4Address.getDefaultInstance(routerInfo.getServicePeerIp()));
dataflowBuilder.setPrefix(intent.getPrefix());
dataflowBuilder.setGlobalIp(Ipv4Address.getDefaultInstance(routerInfo.getServicePeerIp()));
dataflowBuilder.setPathId(routerInfo.getPeerPathId());
final List<AsNumbers> asNumbers = Lists.newArrayList();
final AsNumbersBuilder asNumbersBuilder = new AsNumbersBuilder();
asNumbersBuilder.setAsNumber(AsNumber.getDefaultInstance(routerInfo.getAsn().toString()));
asNumbers.add(asNumbersBuilder.build());
dataflowBuilder.setAsNumbers(asNumbers);
bgpDataflowByPeerIp.put(Ipv4Address.getDefaultInstance(
routerInfo.getServicePeerIp()), dataflowBuilder.build());
});
return bgpDataflowByPeerIp;
}
开发者ID:opendaylight,项目名称:nic,代码行数:23,代码来源:CommonUtils.java
示例11: testPerPeerHeaderIpv6
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address; //导入依赖的package包/类
@Test
public void testPerPeerHeaderIpv6() {
final PeerHeader perHeader = AbstractBmpPerPeerMessageParser
.parsePerPeerHeader(Unpooled.wrappedBuffer(this.ipv6MsgWithDistinguishergBytes));
final PeerHeaderBuilder phBuilder = new PeerHeaderBuilder();
phBuilder.setType(PeerType.L3vpn);
phBuilder.setPeerDistinguisher(new PeerDistinguisher(
new RouteDistinguisher(new RdTwoOctetAs("0:" + RD))));
phBuilder.setAdjRibInType(AdjRibInType.forValue(1));
phBuilder.setIpv4(false);
phBuilder.setAddress(new IpAddress(new Ipv6Address("2001::1")));
phBuilder.setAs(new AsNumber(168L));
phBuilder.setBgpId(new Ipv4Address("1.1.1.2"));
phBuilder.setTimestampSec(new Timestamp(0L));
phBuilder.setTimestampMicro(new Timestamp(0L));
assertEquals(phBuilder.build(), perHeader);
final ByteBuf aggregator = Unpooled.buffer();
phBuilder.setTimestampSec(null);
phBuilder.setTimestampMicro(null);
this.parser.serializePerPeerHeader(phBuilder.build(), aggregator);
assertArrayEquals(this.ipv6MsgWithDistinguishergBytes, ByteArray.getAllBytes(aggregator));
}
开发者ID:opendaylight,项目名称:bgpcep,代码行数:27,代码来源:AbstractBmpPerPeerMessageParserTest.java
示例12: createPeerUpNotification
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address; //导入依赖的package包/类
public static PeerUpNotification createPeerUpNotification(final Ipv4Address bgpId, final boolean multiprotocol) {
final PeerUpNotificationBuilder peerUpNotifBuilder = new PeerUpNotificationBuilder()
.setLocalAddress(new IpAddress(IPV4_ADDRESS_10))
.setLocalPort(PEER_LOCAL_PORT)
.setPeerHeader(createPeerHeader(bgpId))
.setReceivedOpen(new ReceivedOpenBuilder(createOpen(multiprotocol)).build())
.setRemotePort(PEER_REMOTE_PORT)
.setSentOpen((SentOpen) createOpen(multiprotocol))
.setInformation(new InformationBuilder().setStringInformation(
ImmutableList.<StringInformation>builder().add(
new StringInformationBuilder().setStringTlv(
new StringTlvBuilder().setStringInfo("aaaa")
.build()).build()).build()).build());
return peerUpNotifBuilder.build();
}
开发者ID:opendaylight,项目名称:bgpcep,代码行数:17,代码来源:TestUtil.java
示例13: testNoAs4BytesCapability
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address; //导入依赖的package包/类
@Test
public void testNoAs4BytesCapability() {
this.clientSession.channelActive(null);
assertEquals(1, this.receivedMsgs.size());
assertTrue(this.receivedMsgs.get(0) instanceof Open);
final List<BgpParameters> tlvs = Lists.newArrayList();
final List<OptionalCapabilities> capas = Lists.newArrayList();
capas.add(new OptionalCapabilitiesBuilder().setCParameters(new CParametersBuilder().addAugmentation(CParameters1.class,
new CParameters1Builder().setMultiprotocolCapability(new MultiprotocolCapabilityBuilder()
.setAfi(this.ipv4tt.getAfi()).setSafi(this.ipv4tt.getSafi()).build()).build()).build()).build());
capas.add(new OptionalCapabilitiesBuilder().setCParameters(BgpExtendedMessageUtil.EXTENDED_MESSAGE_CAPABILITY).build());
tlvs.add(new BgpParametersBuilder().setOptionalCapabilities(capas).build());
// Open Message without advertised four-octet AS Number capability
this.clientSession.handleMessage(new OpenBuilder().setMyAsNumber(30).setHoldTimer(1).setVersion(
new ProtocolVersion((short) 4)).setBgpParameters(tlvs).setBgpIdentifier(new Ipv4Address("1.1.1.2")).build());
assertEquals(2, this.receivedMsgs.size());
assertTrue(this.receivedMsgs.get(1) instanceof Notify);
final Notification m = this.receivedMsgs.get(this.receivedMsgs.size() - 1);
assertEquals(BGPError.UNSUPPORTED_CAPABILITY, BGPError.forValue(((Notify) m).getErrorCode(), ((Notify) m).getErrorSubcode()));
assertNotNull(((Notify) m).getData());
}
开发者ID:opendaylight,项目名称:bgpcep,代码行数:23,代码来源:FSMTest.java
示例14: testGetValidReportsPositive
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address; //导入依赖的package包/类
@Test
public void testGetValidReportsPositive() {
final PcRptMessageCodec codec = new PcRptMessageCodec(this.ctx.getObjectHandlerRegistry());
final BandwidthUsage bw = new BandwidthUsageBuilder().setBwSample(BW).build();
final Ipv4Builder builder = new Ipv4Builder();
builder.setIpv4TunnelSenderAddress(new Ipv4Address("127.0.1.1"));
builder.setIpv4ExtendedTunnelId(new Ipv4ExtendedTunnelId(new Ipv4Address("127.0.1.2")));
builder.setIpv4TunnelEndpointAddress(new Ipv4Address("127.0.1.3"));
final AddressFamily afiLsp = new Ipv4CaseBuilder().setIpv4(builder.build()).build();
final LspId lspId = new LspId(1L);
final TunnelId tunnelId = new TunnelId(1);
final LspIdentifiers identifier = new LspIdentifiersBuilder().setAddressFamily(afiLsp)
.setLspId(lspId).setTunnelId(tunnelId).build();
final Lsp lsp = new LspBuilder().setPlspId(new PlspId(1L))
.setTlvs(new TlvsBuilder().setLspIdentifiers(identifier).build()).build();
final Ero ero = new EroBuilder().build();
final List<Object> objects = Lists.newArrayList(lsp, ero, bw);
final Reports validReports = codec.getValidReports(objects, Collections.emptyList());
assertNotNull(validReports.getPath().getBandwidth().getAugmentation(Bandwidth1.class));
assertTrue(objects.isEmpty());
}
开发者ID:opendaylight,项目名称:bgpcep,代码行数:22,代码来源:PcRptMessageCodecTest.java
示例15: createNode
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address; //导入依赖的package包/类
private static Node createNode(final NodeId nodeId, final TpId tpId, final String ipv4Address) {
final TerminationPointBuilder tpBuilder = new TerminationPointBuilder();
tpBuilder.setTpId(tpId);
tpBuilder.setKey(new TerminationPointKey(tpId));
tpBuilder.addAugmentation(TerminationPoint1.class, new TerminationPoint1Builder()
.setIgpTerminationPointAttributes(new IgpTerminationPointAttributesBuilder()
.setTerminationPointType(new IpBuilder()
.setIpAddress(Collections.singletonList(new IpAddress(new Ipv4Address(ipv4Address))))
.build()).build()).build());
final NodeBuilder nodeBuilder = new NodeBuilder();
nodeBuilder.setNodeId(nodeId);
nodeBuilder.setKey(new NodeKey(nodeId));
nodeBuilder.setTerminationPoint(Lists.newArrayList(tpBuilder.build()));
final SupportingNode supportingNode = new SupportingNodeBuilder()
.setKey(new SupportingNodeKey(nodeId, new TopologyId("dummy")))
.addAugmentation(SupportingNode1.class, new SupportingNode1Builder()
.setPathComputationClient(new PathComputationClientBuilder()
.setControlling(true).build()).build()).build();
nodeBuilder.setSupportingNode(Lists.newArrayList(supportingNode));
return nodeBuilder.build();
}
开发者ID:opendaylight,项目名称:bgpcep,代码行数:22,代码来源:TunnelProgrammingTest.java
示例16: testSrRroSubobjectIpv4AdjacencyNAI
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address; //导入依赖的package包/类
@Test
public void testSrRroSubobjectIpv4AdjacencyNAI() throws PCEPDeserializerException {
final SrRroTypeBuilder builder = new SrRroTypeBuilder();
builder.setSidType(SidType.Ipv4Adjacency);
builder.setSid(123456L);
builder.setCFlag(false);
builder.setMFlag(false);
builder.setNai(new IpAdjacencyBuilder().setLocalIpAddress(new IpAddress(new Ipv4Address("74.125.43.99")))
.setRemoteIpAddress(new IpAddress(new Ipv4Address("74.125.43.100"))).build());
final SubobjectBuilder subobjBuilder = new SubobjectBuilder().setSubobjectType(builder.build());
assertEquals(subobjBuilder.build(), this.parser.parseSubobject(Unpooled.wrappedBuffer(ByteArray.cutBytes(srRroSubobjectWithIpv4Adjacency, 2))));
final ByteBuf buffer = Unpooled.buffer();
this.parser.serializeSubobject(subobjBuilder.build(), buffer);
assertArrayEquals(srRroSubobjectWithIpv4Adjacency, ByteArray.getAllBytes(buffer));
}
开发者ID:opendaylight,项目名称:bgpcep,代码行数:17,代码来源:SrRroSubobjectParserTest.java
示例17: buildValidExtClassifier
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address; //导入依赖的package包/类
public static ExtClassifier buildValidExtClassifier() {
return new ExtClassifierBuilder()
.setSrcIp(new Ipv4Address("10.0.0.100"))
.setSrcIpMask(new Ipv4Address("255.255.255.0"))
.setSrcPortStart(new PortNumber(7000))
.setSrcPortEnd(new PortNumber((7005)))
.setDstIp(new Ipv4Address("10.0.0.200"))
.setDstIpMask(new Ipv4Address("255.255.255.0"))
.setDstPortStart(new PortNumber(7000))
.setDstPortEnd(new PortNumber(7005))
.setProtocol(new TpProtocol(127))
.setTosByte(new TosByte((short)0x10))
.setTosMask(new TosByte((short)0xf0))
.setActivationState(ClassifierActivationState.Active)
.build();
}
开发者ID:opendaylight,项目名称:packetcable,代码行数:17,代码来源:ExtClassifierValidatorTest.java
示例18: setUp
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address; //导入依赖的package包/类
@Before
public void setUp() throws BGPDocumentedException {
if (!Epoll.isAvailable()) {
this.boss = new NioEventLoopGroup();
this.worker = new NioEventLoopGroup();
}
this.registry = new StrictBGPPeerRegistry();
this.clientListener = new SimpleSessionListener();
this.serverListener = new SimpleSessionListener();
final BGPExtensionProviderContext ctx = ServiceLoaderBGPExtensionProviderContext.getSingletonInstance();
this.serverDispatcher = new BGPDispatcherImpl(ctx.getMessageRegistry(), this.boss, this.worker, this.registry);
this.clientAddress = InetSocketAddressUtil.getRandomLoopbackInetSocketAddress();
final IpAddress clientPeerIp = new IpAddress(new Ipv4Address(this.clientAddress.getAddress().getHostAddress()));
this.registry.addPeer(clientPeerIp, this.clientListener, createPreferences(this.clientAddress));
this.clientDispatcher = new BGPDispatcherImpl(ctx.getMessageRegistry(), this.boss, this.worker, this.registry);
}
开发者ID:opendaylight,项目名称:bgpcep,代码行数:18,代码来源:AbstractBGPDispatcherTest.java
示例19: testSrEroSubobjectIpv4AdjacencyNAI
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address; //导入依赖的package包/类
@Test
public void testSrEroSubobjectIpv4AdjacencyNAI() throws PCEPDeserializerException {
final SrEroTypeBuilder builder = new SrEroTypeBuilder();
builder.setSidType(SidType.Ipv4Adjacency);
builder.setSid(123456L);
builder.setCFlag(false);
builder.setMFlag(false);
builder.setNai(new IpAdjacencyBuilder().setLocalIpAddress(new IpAddress(new Ipv4Address("74.125.43.99")))
.setRemoteIpAddress(new IpAddress(new Ipv4Address("74.125.43.100"))).build());
final SubobjectBuilder subobjBuilder = new SubobjectBuilder().setSubobjectType(builder.build()).setLoose(false);
assertEquals(subobjBuilder.build(), this.parser.parseSubobject(Unpooled.wrappedBuffer(ByteArray.cutBytes(srEroSubobjectWithIpv4Adjacency, 2)), false));
final ByteBuf buffer = Unpooled.buffer();
this.parser.serializeSubobject(subobjBuilder.build(), buffer);
assertArrayEquals(srEroSubobjectWithIpv4Adjacency, ByteArray.getAllBytes(buffer));
}
开发者ID:opendaylight,项目名称:bgpcep,代码行数:17,代码来源:SrEroSubobjectParserTest.java
示例20: testPccIdReqIPv4Object
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address; //导入依赖的package包/类
@Test
public void testPccIdReqIPv4Object() throws PCEPDeserializerException {
final byte[] pccIdReqBytes = {
/* object header */
0x14, 0x10, 0x00, 0x08,
/* ipv4 address */
0x7f, 0x00, 0x00, 0x01
};
final PCEPPccIdReqIPv4ObjectParser parser = new PCEPPccIdReqIPv4ObjectParser();
final PccIdReq pccIdReq = new PccIdReqBuilder().setIpAddress(new IpAddress(new Ipv4Address("127.0.0.1"))).build();
final ByteBuf result = Unpooled.wrappedBuffer(pccIdReqBytes);
assertEquals(pccIdReq, parser.parseObject(new ObjectHeaderImpl(false, false), result.slice(4, result.readableBytes() - 4)));
final ByteBuf buf = Unpooled.buffer(pccIdReqBytes.length);
parser.serializeObject(pccIdReq, buf);
assertArrayEquals(pccIdReqBytes, buf.array());
}
开发者ID:opendaylight,项目名称:bgpcep,代码行数:18,代码来源:PCEPObjectParserTest.java
注:本文中的org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论