Search in sources :

Example 1 with PortData

use of org.opendaylight.lispflowmapping.neutron.mappingmanager.PortData in project lispflowmapping by opendaylight.

the class PortDataProcessor method update.

@Override
public void update(Port port) {
    final String hostId = port.getAugmentation(PortBindingExtension.class).getHostId();
    if (hostId == null) {
        LOG.error("Updating 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) {
            eidAddress = getEid(port, ip);
            PortData portData = new PortData(port.getUuid().getValue(), eidAddress);
            hostInformationManager.addHostRelatedInfo(hostId, portData);
        }
    }
    LOG.info("Neutron Port updated: Port name: " + port.getName() + " Port Fixed IP: " + (port.getFixedIps() != null ? port.getFixedIps().get(0) : "No Fixed IP assigned"));
    LOG.debug("Neutron Port Updated : " + port.toString());
}
Also used : Eid(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid) PortData(org.opendaylight.lispflowmapping.neutron.mappingmanager.PortData) FixedIps(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.port.attributes.FixedIps) PortBindingExtension(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.binding.rev150712.PortBindingExtension)

Example 2 with PortData

use of org.opendaylight.lispflowmapping.neutron.mappingmanager.PortData 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"));
}
Also used : Eid(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid) PortData(org.opendaylight.lispflowmapping.neutron.mappingmanager.PortData) FixedIps(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.port.attributes.FixedIps) PortBindingExtension(org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.binding.rev150712.PortBindingExtension)

Aggregations

PortData (org.opendaylight.lispflowmapping.neutron.mappingmanager.PortData)2 Eid (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.eid.container.Eid)2 PortBindingExtension (org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.binding.rev150712.PortBindingExtension)2 FixedIps (org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.port.attributes.FixedIps)2