Merge "Unit test for ovsdb.southbound.ovsdb.transact"
[netvirt.git] / openstack / net-virt / src / main / java / org / opendaylight / ovsdb / openstack / netvirt / api / SecurityServicesManager.java
index 785d54be001c1723a03a81d645f98a1a10aa1ecd..997b7668256259d73735c8795207cdcc31de6f34 100644 (file)
@@ -1,19 +1,23 @@
 /*
- * Copyright (C) 2014 Red Hat, Inc.
+ * Copyright (c) 2014, 2015 Red Hat, Inc. and others. All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
  */
 
 package org.opendaylight.ovsdb.openstack.netvirt.api;
 
-import org.opendaylight.neutron.spi.NeutronSecurityGroup;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.*;
+import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronPort;
+import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronSecurityGroup;
+import org.opendaylight.ovsdb.openstack.netvirt.translator.Neutron_IPs;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbTerminationPointAugmentation;
+import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
+
+import java.util.List;
 
 /**
- * Open vSwitch isolates Tenant Networks using VLANs on the Integration Bridge
+ * Open vSwitch isolates Tenant Networks using VLANs on the Integration Bridge.
  * This class manages the provisioning of these VLANs
  */
 public interface SecurityServicesManager {
@@ -23,13 +27,73 @@ public interface SecurityServicesManager {
      * @param intf the intf
      * @return the boolean
      */
-    public boolean isPortSecurityReady(OvsdbTerminationPointAugmentation intf);
+    boolean isPortSecurityReady(OvsdbTerminationPointAugmentation intf);
     /**
      * Gets security group in port.
      *
      * @param intf the intf
-     * @return the security group in port
+     * @return the list of security group in port, returns empty list if no group associated.
+     */
+    List<NeutronSecurityGroup> getSecurityGroupInPortList(OvsdbTerminationPointAugmentation intf);
+    /**
+     * Gets the DHCP server port corresponding to a network.
+     *
+     * @param intf the intf
+     * @return the dhcp server port
+     */
+    NeutronPort getDhcpServerPort(OvsdbTerminationPointAugmentation intf);
+
+    /**
+      * Check if the given interface corresponds to a DHCP server port.
+      *
+      * @param intf the intf
+      * @return Return the DHCP neutron port
+      */
+    NeutronPort getNeutronPortFromDhcpIntf(OvsdbTerminationPointAugmentation intf);
+
+    /**
+     * Is the port a compute port.
+     *
+     * @param intf the intf
+     * @return  whether it is a compute port or not
      */
-    public NeutronSecurityGroup getSecurityGroupInPort(OvsdbTerminationPointAugmentation intf);
+    boolean isComputePort(OvsdbTerminationPointAugmentation intf);
 
-}
\ No newline at end of file
+    /**
+     * Is this the last port in the subnet to which interface belongs to.
+     * @param node The node to which the intf is connected.
+     * @param intf the intf
+     * @return whether last port in the subnet
+     */
+    boolean isLastPortinSubnet(Node node, OvsdbTerminationPointAugmentation intf);
+
+    /**
+     * Is this the last port in the bridge to which interface belongs to.
+     * @param node The node to which the intf is connected.
+     * @param intf the intf
+     * @return whether last port in bridge
+     */
+    boolean isLastPortinBridge(Node node, OvsdbTerminationPointAugmentation intf);
+    /**
+     * Returns the  list of ip address assigned to the interface.
+     * @param node The node to which the intf is connected.
+     * @param intf the intf
+     * @return the list of ip address associated with the vm
+     */
+    List<Neutron_IPs> getIpAddressList(Node node, OvsdbTerminationPointAugmentation intf);
+    /**
+     * Get the list of vm belonging to a security group.
+     * @param srcAddressList the address list of the connected vm.
+     * @param securityGroupUuid the UUID of the remote security group.
+     * @return the list of all vm belonging to the security group UUID passed.
+     */
+    List<Neutron_IPs> getVmListForSecurityGroup(List<Neutron_IPs> srcAddressList,
+                                                String securityGroupUuid);
+    /**
+     * Add or remove the security groups rules from the port.
+     * @param port the neutron port.
+     * @param securityGroup the security group associated with the port.
+     * @param write whether to add/delete flow.
+     */
+    void syncSecurityGroup(NeutronPort port, List<NeutronSecurityGroup> securityGroup, boolean write);
+}