Augment postman neutron collection and added FloatingIPHandler skeleton.
[netvirt.git] / openstack / net-virt / src / main / java / org / opendaylight / ovsdb / openstack / netvirt / FloatingIPHandler.java
1 /*
2  * Copyright (C) 2014 Red Hat, Inc.
3  *
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
7  *
8  * Authors : Dave Tucker, Flavio Fernandes
9  */
10 package org.opendaylight.ovsdb.openstack.netvirt;
11
12 import org.opendaylight.controller.networkconfig.neutron.INeutronFloatingIPAware;
13 import org.opendaylight.controller.networkconfig.neutron.NeutronFloatingIP;
14 import org.opendaylight.ovsdb.plugin.api.OvsdbConfigurationService;
15 import org.opendaylight.ovsdb.plugin.api.OvsdbConnectionService;
16 import org.opendaylight.ovsdb.plugin.api.OvsdbInventoryListener;
17
18 import org.slf4j.Logger;
19 import org.slf4j.LoggerFactory;
20
21 import java.net.HttpURLConnection;
22
23 /**
24  * Handle requests for Neutron Floating IP.
25  */
26 public class FloatingIPHandler extends AbstractHandler
27         implements INeutronFloatingIPAware {
28
29     /**
30      * Logger instance.
31      */
32     static final Logger logger = LoggerFactory.getLogger(FloatingIPHandler.class);
33
34     private volatile OvsdbConfigurationService ovsdbConfigurationService;
35     private volatile OvsdbConnectionService connectionService;
36     private volatile OvsdbInventoryListener ovsdbInventoryListener;
37
38     /**
39      * Services provide this interface method to indicate if the specified floatingIP can be created
40      *
41      * @param floatingIP
42      *            instance of proposed new Neutron FloatingIP object
43      * @return integer
44      *            the return value is understood to be a HTTP status code.  A return value outside of 200 through 299
45      *            results in the create operation being interrupted and the returned status value reflected in the
46      *            HTTP response.
47      */
48     @Override
49     public int canCreateFloatingIP(NeutronFloatingIP floatingIP) {
50         return HttpURLConnection.HTTP_OK;
51     }
52
53
54     /**
55      * Services provide this interface method for taking action after a floatingIP has been created
56      *
57      * @param floatingIP
58      *            instance of new Neutron FloatingIP object
59      */
60     @Override
61     public void neutronFloatingIPCreated(NeutronFloatingIP floatingIP) {
62         logger.debug(" Floating IP created {}, uuid {}",
63                      floatingIP.getFixedIPAddress(),
64                      floatingIP.getFloatingIPUUID());
65     }
66
67     /**
68      * Services provide this interface method to indicate if the specified floatingIP can be changed using the specified
69      * delta
70      *
71      * @param delta
72      *            updates to the floatingIP object using patch semantics
73      * @param original
74      *            instance of the Neutron FloatingIP object to be updated
75      * @return integer
76      *            the return value is understood to be a HTTP status code.  A return value outside of 200 through 299
77      *            results in the update operation being interrupted and the returned status value reflected in the
78      *            HTTP response.
79      */
80     @Override
81     public int canUpdateFloatingIP(NeutronFloatingIP delta, NeutronFloatingIP original) {
82         return HttpURLConnection.HTTP_OK;
83     }
84
85     /**
86      * Services provide this interface method for taking action after a floatingIP has been updated
87      *
88      * @param floatingIP
89      *            instance of modified Neutron FloatingIP object
90      */
91     @Override
92     public void neutronFloatingIPUpdated(NeutronFloatingIP floatingIP) {
93         logger.debug(" Floating IP updated {}, uuid {}",
94                      floatingIP.getFixedIPAddress(),
95                      floatingIP.getFloatingIPUUID());
96     }
97
98     /**
99      * Services provide this interface method to indicate if the specified floatingIP can be deleted
100      *
101      * @param floatingIP
102      *            instance of the Neutron FloatingIP object to be deleted
103      * @return integer
104      *            the return value is understood to be a HTTP status code.  A return value outside of 200 through 299
105      *            results in the delete operation being interrupted and the returned status value reflected in the
106      *            HTTP response.
107      */
108     @Override
109     public int canDeleteFloatingIP(NeutronFloatingIP floatingIP) {
110         return HttpURLConnection.HTTP_OK;
111     }
112
113     /**
114      * Services provide this interface method for taking action after a floatingIP has been deleted
115      *
116      * @param floatingIP
117      *            instance of deleted Neutron FloatingIP object
118      */
119     @Override
120     public void neutronFloatingIPDeleted(NeutronFloatingIP floatingIP) {
121         logger.debug(" Floating IP deleted {}, uuid {}",
122                      floatingIP.getFixedIPAddress(),
123                      floatingIP.getFloatingIPUUID());
124     }
125 }