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 VppNodeReader method readIpAddressFromInterface.
private Optional<Ipv4Address> readIpAddressFromInterface(Interface intf, KeyedInstanceIdentifier iiToVpp) {
Interface2 augIntf = intf.getAugmentation(Interface2.class);
if (augIntf == null) {
LOG.debug("Cannot get Interface2 augmentation for intf {}");
return Optional.absent();
}
Ipv4 ipv4 = augIntf.getIpv4();
if (ipv4 == null) {
LOG.debug("Ipv4 address for interface {} on node {} is null!", augIntf, InfoUtil.node(iiToVpp));
return Optional.absent();
}
final List<Address> addresses = ipv4.getAddress();
if (addresses == null || addresses.isEmpty()) {
LOG.debug("Ipv4 addresses list is empty for interface {} on node {}", augIntf, InfoUtil.node(iiToVpp));
return Optional.absent();
}
final Ipv4AddressNoZone ip = addresses.iterator().next().getIp();
if (ip == null) {
LOG.debug("Ipv4AddressNoZone is null for node {}", InfoUtil.node(iiToVpp));
return Optional.absent();
}
LOG.debug("Got ip address {} from interface {} on node {}", ip.getValue(), intf.getName(), InfoUtil.node(iiToVpp));
return Optional.of(ip);
}
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 SubnetDataProcessor method create.
/**
* Method adds the newly created subnet as an EID prefix to the
* MappingService. The subnet's network UUID is used as the key for this EID
* prefix.
*/
@Override
public void create(Subnet subnet) {
// TODO update for multi-tenancy
LOG.info("Neutron Subnet Created request : Subnet name: " + subnet.getName() + " Subnet Cidr: " + subnet.getCidr());
LOG.debug("Lisp Neutron Subnet: " + subnet.toString());
// Determine the IANA code for the subnet IP version
// Default is set to IPv4 for neutron subnets
final Eid eid = LispAddressUtil.asIpv4PrefixEid(String.valueOf(subnet.getCidr().getValue()));
try {
final OdlMappingserviceService lfmdb = lispNeutronService.getMappingDbService();
if (lfmdb == null) {
LOG.debug("lfmdb is null!!!");
return;
}
final AddKeyInput addKeyInput = LispUtil.buildAddKeyInput(eid, subnet.getUuid().getValue());
final Future<RpcResult<Void>> result = lfmdb.addKey(addKeyInput);
final Boolean isSuccessful = result.get().isSuccessful();
if (isSuccessful) {
LOG.debug("Neutron Subnet Added to MapServer : Subnet name: " + subnet.getName() + " EID Prefix: " + subnet.getCidr() + " Key: " + subnet.getUuid());
}
LOG.info("Neutron Subnet Created request : Subnet name: " + subnet.getName() + " Subnet Cidr: " + subnet.getCidr());
} catch (InterruptedException | ExecutionException e) {
LOG.error("Adding new subnet to lisp service mapping service failed. Subnet : " + subnet.toString() + "Error: " + ExceptionUtils.getStackTrace(e));
}
}
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 MappingSystemTest method getMappingTest_NbFirst_withNullExpiredNbMapping.
/**
* Tests {@link MappingSystem#getMapping} method with NB mapping == null, expired mapping.
*/
@Test
public void getMappingTest_NbFirst_withNullExpiredNbMapping() {
final MappingData mappingData = getDefaultMappingData();
mappingData.setTimestamp(EXPIRED_DATE);
Mockito.when(pmcMock.getMapping(EID_IPV4_SRC, EID_IPV4_DST)).thenReturn(null);
Mockito.when(smcMock.getMapping(EID_IPV4_DST, (XtrId) null)).thenReturn(mappingData, null);
final Mapping mapping = new MappingBuilder().setEidUri(new EidUri("ipv4:" + IPV4_DST)).setOrigin(MappingOrigin.Southbound).setSiteId(Lists.newArrayList(SITE_ID)).setMappingRecord(mappingData.getRecord()).build();
assertNull(mappingSystem.getMapping(EID_IPV4_SRC, EID_IPV4_DST));
Mockito.verify(dsbeMock).removeMapping(mapping);
}
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 MappingSystemTest method getMappingTest_NbSbIntersection_withServicePathDestinationAddress.
/**
* Tests {@link MappingSystem#getMapping} method, northbound and southbound intersection with ServicePath type dst
* address and single Ipv4 type locator record. Returns the original mapping.
*/
@Test
public void getMappingTest_NbSbIntersection_withServicePathDestinationAddress() throws NoSuchFieldException, IllegalAccessException {
setLookupPolicy(IMappingService.LookupPolicy.NB_AND_SB);
final MappingRecord mappingRecord = getDefaultMappingRecordBuilder().setLocatorRecord(Lists.newArrayList(// Ipv4 type Rloc
getDefaultLocatorRecordBuilder().build())).build();
final MappingData mappingData = getDefaultMappingData(mappingRecord);
Mockito.when(pmcMock.getMapping(EID_IPV4_SRC, EID_SERVICE_PATH)).thenReturn(mappingData);
assertEquals(mappingData, mappingSystem.getMapping(EID_IPV4_SRC, EID_SERVICE_PATH));
}
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 MappingSystemTest method getMappingTest_NbFirst.
/**
* Tests {@link MappingSystem#getMapping} method with Ipv4 type dst address.
*/
@Test
public void getMappingTest_NbFirst() {
final MappingRecord mappingRecord = getDefaultMappingRecordBuilder().setLocatorRecord(Lists.newArrayList(getDefaultLocatorRecordBuilder().build())).build();
final MappingData mappingData = getDefaultMappingData(mappingRecord);
Mockito.when(pmcMock.getMapping(EID_IPV4_SRC, EID_IPV4_DST)).thenReturn(mappingData);
assertEquals(mappingData, mappingSystem.getMapping(EID_IPV4_SRC, EID_IPV4_DST));
}
Aggregations