2 * Copyright (c) 2014 Cisco Systems, Inc. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.lispflowmapping.neutron;
11 import java.net.HttpURLConnection;
13 import org.opendaylight.controller.networkconfig.neutron.INeutronPortAware;
14 import org.opendaylight.controller.networkconfig.neutron.NeutronPort;
17 * Lisp Service implementation of NeutronPortAware API
18 * Creation of a new port results adding the mapping for
19 * the port's IP addresses to the port's host_ip in the mapping service.
20 * Currently the NetronPort object does not carry the required information
21 * to achieve the port's host_ip. Once such extension is available
22 * this class shall be updated.
25 public class LispNeutronPortHandler extends LispNeutronService implements INeutronPortAware {
29 public int canCreatePort(NeutronPort port) {
30 logger.info("Neutron canCreatePort : Port name: " + port.getName());
32 return HttpURLConnection.HTTP_OK;
36 public void neutronPortCreated(NeutronPort port) {
37 // TODO Consider adding Port MAC -> Port fixed IP in MS
38 // TODO Add Port fixed ip -> host ip mapping in MS - Requires extension of Port object
40 logger.info("Neutron Port Created: Port name: " + port.getName() + " Port Fixed IP: " +
41 ( port.getFixedIPs() != null ? port.getFixedIPs().get(0) : "No Fixed IP assigned" ));
42 logger.debug("Neutron Port Created : " + port.toString());
47 public int canUpdatePort(NeutronPort delta, NeutronPort original) {
48 // TODO Port IP and port's host ip is stored by Lisp Neutron Service. If there is change to these fields, the update needs to be processed.
50 logger.info("Neutron canUpdatePort : Port name: " + original.getName() + " Port Fixed IP: " +
51 ( original.getFixedIPs() != null ? original.getFixedIPs().get(0) : "No Fixed IP assigned" ));
52 logger.debug("Neutron canUpdatePort : original" + original.toString() + " delta : " + delta.toString());
54 return HttpURLConnection.HTTP_OK;
58 public void neutronPortUpdated(NeutronPort port) {
59 // TODO Port IP and port's host ip is stored by Lisp Neutron Service. If there is change to these fields, the update needs to be processed.
61 logger.info("Neutron Port updated: Port name: " + port.getName() + " Port Fixed IP: " +
62 ( port.getFixedIPs() != null ? port.getFixedIPs().get(0) : "No Fixed IP assigned" ));
63 logger.debug("Neutron Port Updated : " + port.toString());
68 public int canDeletePort(NeutronPort port) {
69 // TODO Check if Port IPs are stored by Lisp Neutron Service. if not return error code.
71 logger.info("Neutron canDeletePort : Port name: " + port.getName() + " Port Fixed IP: " +
72 ( port.getFixedIPs() != null ? port.getFixedIPs().get(0) : "No Fixed IP assigned" ));
73 logger.debug("Neutron canDeltePort: " + port.toString());
75 return HttpURLConnection.HTTP_OK;
79 public void neutronPortDeleted(NeutronPort port) {
80 // TODO if port ips existed in MapServer, delete them. Else, log error.
82 logger.info("Neutron Port Deleted: Port name: " + port.getName() + " Port Fixed IP: " +
83 ( port.getFixedIPs() != null ? port.getFixedIPs().get(0) : "No Fixed IP assigned" ));
84 logger.debug("Neutron Port Deleted : " + port.toString());