use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.AsNumber in project bgpcep by opendaylight.
the class AbstractNodeDescriptorTlvCodec method parseNodeDescriptor.
protected static NodeIdentifier parseNodeDescriptor(final ByteBuf value, final Map<QName, Object> parsedSubTlvs) {
parsedSubTlvs.putAll(SimpleNlriTypeRegistry.getInstance().parseSubTlvs(value));
final AsNumber asNumber = (AsNumber) parsedSubTlvs.get(AsNumTlvParser.AS_NUMBER_QNAME);
final DomainIdentifier domainId = (DomainIdentifier) parsedSubTlvs.get(DomainIdTlvParser.DOMAIN_ID_QNAME);
final AreaIdentifier areaId = (AreaIdentifier) parsedSubTlvs.get(AreaIdTlvParser.AREA_ID_QNAME);
final CRouterIdentifier routerId = (CRouterIdentifier) parsedSubTlvs.get(CRouterIdentifier.QNAME);
return new NodeIdentifier() {
@Override
public Class<? extends DataContainer> getImplementedInterface() {
return NodeIdentifier.class;
}
@Override
public AsNumber getAsNumber() {
return asNumber;
}
@Override
public DomainIdentifier getDomainId() {
return domainId;
}
@Override
public AreaIdentifier getAreaId() {
return areaId;
}
@Override
public CRouterIdentifier getCRouterIdentifier() {
return routerId;
}
};
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.AsNumber in project lispflowmapping by opendaylight.
the class LispSimpleAddressStringifierTest method getStringTest_asAsNumber.
/**
* Tests {@link LispSimpleAddressStringifier#getString} with AsNumber.
*/
@Test
public void getStringTest_asAsNumber() {
SimpleAddress simpleAddress = new SimpleAddress(AS_NUMBER);
String result = LispSimpleAddressStringifier.getString(simpleAddress);
assertEquals("AS" + AS_NUMBER.getValue(), result);
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.AsNumber in project lispflowmapping by opendaylight.
the class LispAddressUtilTest method addressFromSimpleAddressTest_asNumber.
/**
* Tests {@link LispAddressUtil#addressTypeFromSimpleAddress} and {@link
* LispAddressUtil#addressFromSimpleAddress} methods
* with address as number.
*/
@Test
public void addressFromSimpleAddressTest_asNumber() {
final SimpleAddress simpleAddress = new SimpleAddress(new AsNumber(NUMBER_TEST));
final Class<? extends LispAddressFamily> addressClass = LispAddressUtil.addressTypeFromSimpleAddress(simpleAddress);
assertEquals(AsNumberAfi.class, addressClass);
final Address address = LispAddressUtil.addressFromSimpleAddress(simpleAddress);
assertTrue(address instanceof org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.AsNumber);
}
use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.AsNumber in project lispflowmapping by opendaylight.
the class LispAddressUtilTest method addressFromAsNumberTest_withAdNumber.
/**
* Test {@link LispAddressUtil#addressFromAsNumber(AsNumber)} method with as number value.
*/
@Test
public void addressFromAsNumberTest_withAdNumber() {
final AsNumber expectedAddress = new AsNumber(AS_NUMBER_TEST);
final Address testedAddress = LispAddressUtil.addressFromAsNumber(expectedAddress);
assertTrue(testedAddress instanceof org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.AsNumber);
assertEquals(expectedAddress, ((org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.lisp.address.address.AsNumber) testedAddress).getAsNumber());
}
Aggregations