use of org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.port.attributes.FixedIps in project netvirt by opendaylight.
the class NeutronPortChangeListenerTest method addPort__NoFixedIps.
@Test
public void addPort__NoFixedIps() throws Exception {
PortBuilder pb = new PortBuilder();
pb.setUuid(new Uuid("12345678-1234-1234-1234-123456789012"));
pb.setNetworkId(new Uuid("12345678-1234-1234-1234-123456789012"));
pb.setMacAddress(new MacAddress("AA:BB:CC:DD:EE:FF"));
List<FixedIps> fixedIps = new ArrayList<>();
pb.setFixedIps(fixedIps);
Port port = pb.build();
neutronPortChangeListener.add(InstanceIdentifier.create(Port.class), port);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.port.attributes.FixedIps in project lispflowmapping by opendaylight.
the class PortDataProcessor method create.
@Override
public void create(Port port) {
// TODO Consider adding Port MAC -> Port fixed IP in MS
// host_ip exists in MS
LOG.debug("Neutron Port Created : " + port.toString());
final String hostId = port.getAugmentation(PortBindingExtension.class).getHostId();
if (hostId == null) {
LOG.error("Adding new Neutron port to lisp mapping service failed. Port does not have a HostID. Port: {}", port.toString());
return;
}
List<FixedIps> fixedIPs = port.getFixedIps();
if (fixedIPs != null && fixedIPs.size() > 0) {
Eid eidAddress;
for (FixedIps ip : fixedIPs) {
// TODO Add check/support for IPv6.
// Get subnet for this port, based on v4 or v6 decide address
// iana code.
eidAddress = getEid(port, ip);
PortData portData = new PortData(port.getUuid().getValue(), eidAddress);
hostInformationManager.addHostRelatedInfo(hostId, portData);
}
}
LOG.info("Neutron Port Created: Port name: " + port.getName() + " Port Fixed IP: " + (port.getFixedIps() != null ? port.getFixedIps().get(0) : "No Fixed IP assigned"));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.port.attributes.FixedIps in project lispflowmapping by opendaylight.
the class PortDataProcessorTest method getEid.
private static Eid getEid(PortDataProcessor portDataProcessor, Port port, FixedIps ip) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
try {
Method method = (portDataProcessor.getClass()).getDeclaredMethod("getEid", Port.class, FixedIps.class);
method.setAccessible(true);
return (Eid) method.invoke(portDataProcessor, port, ip);
} catch (NoSuchMethodException e) {
throw e;
} catch (IllegalAccessException e) {
throw e;
} catch (InvocationTargetException e) {
throw e;
}
}
Aggregations