use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.lsp.identifiers.tlv.lsp.identifiers.address.family.ipv4._case.Ipv4 in project lispflowmapping by opendaylight.
the class DataStoreBackEndTest method updateAuthenticationKeyTest.
/**
* Tests {@link DataStoreBackEnd#updateAuthenticationKey} method.
*/
@Test
public void updateAuthenticationKeyTest() {
final AuthenticationKey authenticationKey = getDefaultAuthenticationKeyBuilder().build();
dataStoreBackEnd.updateAuthenticationKey(authenticationKey);
Mockito.verify(wTxMock).put(Mockito.eq(LogicalDatastoreType.CONFIGURATION), iidCaptorAuthKey.capture(), Mockito.eq(authenticationKey), Mockito.eq(true));
// result
AuthenticationKeyKey result = iidCaptorAuthKey.getValue().firstKeyOf(AuthenticationKey.class);
assertEquals("ipv4:" + IPV4_STRING_1, result.getEidUri().getValue());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.lsp.identifiers.tlv.lsp.identifiers.address.family.ipv4._case.Ipv4 in project lispflowmapping by opendaylight.
the class DataStoreBackEndTest method removeMapping.
/**
* Tests {@link DataStoreBackEnd#removeMapping} method.
*/
@Test
public void removeMapping() {
final Mapping mapping = new MappingBuilder().setMappingRecord(getDefaultMappingRecordBuilder().build()).setOrigin(MappingOrigin.Northbound).build();
dataStoreBackEnd.removeMapping(mapping);
Mockito.verify(wTxMock).delete(Mockito.eq(LogicalDatastoreType.CONFIGURATION), iidCaptorMapping.capture());
// result
MappingKey result = iidCaptorMapping.getValue().firstKeyOf(Mapping.class);
assertEquals("ipv4:" + IPV4_STRING_1, result.getEidUri().getValue());
assertEquals(MappingOrigin.Northbound, result.getOrigin());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.lsp.identifiers.tlv.lsp.identifiers.address.family.ipv4._case.Ipv4 in project lispflowmapping by opendaylight.
the class DataStoreBackEndTest method removeXtrIdMappingTest.
/**
* Tests {@link DataStoreBackEnd#addXtrIdMapping} method.
*/
@Test
public void removeXtrIdMappingTest() {
XtrIdMapping xtrIdMapping = new XtrIdMappingBuilder().setXtrIdUri(new XtrIdUri(DUMMY_URI)).setMappingRecord(getDefaultMappingRecordBuilder().build()).build();
dataStoreBackEnd.removeXtrIdMapping(xtrIdMapping);
Mockito.verify(wTxMock).delete(Mockito.eq(LogicalDatastoreType.OPERATIONAL), iidCaptorXtrIdMapping.capture());
// result
XtrIdMappingKey xtrIdResult = iidCaptorXtrIdMapping.getValue().firstKeyOf(XtrIdMapping.class);
MappingKey mappingResult = iidCaptorXtrIdMapping.getValue().firstKeyOf(Mapping.class);
assertEquals(DatatypeConverter.printHexBinary(XTR_ID), xtrIdResult.getXtrIdUri().getValue());
assertEquals(MappingOrigin.Southbound, mappingResult.getOrigin());
assertEquals("ipv4:" + IPV4_STRING_1, mappingResult.getEidUri().getValue());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.lsp.identifiers.tlv.lsp.identifiers.address.family.ipv4._case.Ipv4 in project lispflowmapping by opendaylight.
the class DataStoreBackEndTest method addMappingTest.
/**
* Tests {@link DataStoreBackEnd#addMapping} method.
*/
@Test
public void addMappingTest() {
final Mapping mapping = new MappingBuilder().setMappingRecord(getDefaultMappingRecordBuilder().build()).setOrigin(MappingOrigin.Northbound).build();
dataStoreBackEnd.addMapping(mapping);
Mockito.verify(wTxMock).put(Mockito.eq(LogicalDatastoreType.CONFIGURATION), iidCaptorMapping.capture(), Mockito.eq(mapping), Mockito.eq(true));
// result
MappingKey result = iidCaptorMapping.getValue().firstKeyOf(Mapping.class);
assertEquals("ipv4:" + IPV4_STRING_1, result.getEidUri().getValue());
assertEquals(MappingOrigin.Northbound, result.getOrigin());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev200720.lsp.identifiers.tlv.lsp.identifiers.address.family.ipv4._case.Ipv4 in project bgpcep by opendaylight.
the class PCEPEndPointsIpv4ObjectParser method serializeObject.
@Override
public void serializeObject(final Object object, final ByteBuf buffer) {
Preconditions.checkArgument(object instanceof EndpointsObj, "Wrong instance of PCEPObject. Passed %s. Needed EndpointsObject.", object.getClass());
final EndpointsObj ePObj = (EndpointsObj) object;
final AddressFamily afi = ePObj.getAddressFamily();
if (afi instanceof Ipv6Case) {
PCEPEndPointsIpv6ObjectParser.serializeObject(object, buffer);
}
Preconditions.checkArgument(afi instanceof Ipv4Case, "Wrong instance of NetworkAddress. Passed %s. Needed IPv4", afi.getClass());
final Ipv4 ipv4 = ((Ipv4Case) afi).getIpv4();
final ByteBuf body = Unpooled.buffer(Ipv4Util.IP4_LENGTH + Ipv4Util.IP4_LENGTH);
Preconditions.checkArgument(ipv4.getSourceIpv4Address() != null, "SourceIpv4Address is mandatory.");
writeIpv4Address(ipv4.getSourceIpv4Address(), body);
Preconditions.checkArgument(ipv4.getDestinationIpv4Address() != null, "DestinationIpv4Address is mandatory.");
writeIpv4Address(ipv4.getDestinationIpv4Address(), body);
ObjectUtil.formatSubobject(TYPE, CLASS, object.isProcessingRule(), object.isIgnore(), body, buffer);
}
Aggregations