X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=openstack%2Fnet-virt-providers%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fovsdb%2Fopenstack%2Fnetvirt%2Fproviders%2Fopenflow13%2FOF13Provider.java;h=c354d2dcefe32bc8d504ac8144a6c9fc0089b921;hb=72fe035fa1234f1f5a068979e5d71ea94e901e2b;hp=2f381f418ca61f21f0786e209c446380d5f786e7;hpb=145c555253a19bc05ca2680cbcf1aff84000be31;p=netvirt.git diff --git a/openstack/net-virt-providers/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/providers/openflow13/OF13Provider.java b/openstack/net-virt-providers/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/providers/openflow13/OF13Provider.java index 2f381f418c..c354d2dcef 100644 --- a/openstack/net-virt-providers/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/providers/openflow13/OF13Provider.java +++ b/openstack/net-virt-providers/src/main/java/org/opendaylight/ovsdb/openstack/netvirt/providers/openflow13/OF13Provider.java @@ -1,22 +1,28 @@ -/** - * Copyright (C) 2013 Red Hat, Inc. +/* + * Copyright (c) 2013, 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.providers.openflow13; +import java.net.InetAddress; +import java.util.List; +import java.util.Map; +import java.util.concurrent.ExecutionException; + import org.opendaylight.controller.md.sal.binding.api.DataBroker; import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction; import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction; import org.opendaylight.controller.md.sal.binding.api.WriteTransaction; import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType; import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException; -import org.opendaylight.neutron.spi.NeutronNetwork; -import org.opendaylight.neutron.spi.NeutronPort; -import org.opendaylight.neutron.spi.NeutronSecurityGroup; -import org.opendaylight.neutron.spi.Neutron_IPs; +import org.opendaylight.ovsdb.openstack.netvirt.translator.NeutronNetwork; +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.ovsdb.openstack.netvirt.MdsalHelper; import org.opendaylight.ovsdb.openstack.netvirt.NetworkHandler; import org.opendaylight.ovsdb.openstack.netvirt.api.BridgeConfigurationManager; @@ -77,11 +83,10 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId; import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId; import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes; -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 org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.node.TerminationPoint; import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey; +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 org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; @@ -94,11 +99,6 @@ import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.google.common.util.concurrent.CheckedFuture; -import java.net.InetAddress; -import java.util.List; -import java.util.Map; -import java.util.concurrent.ExecutionException; - /** * Open vSwitch OpenFlow 1.3 Networking Provider for OpenStack Neutron @@ -108,8 +108,11 @@ import java.util.concurrent.ExecutionException; * @author Dave Tucker * @author Sam Hague */ +// Methods' parameters in this class follow the same pattern to avoid confusion between same-typed parameters +// The patterns need to be preserved even though not all parameters are used in all methods +@SuppressWarnings("UnusedParameters") public class OF13Provider implements ConfigInterface, NetworkingProvider { - private static final Logger logger = LoggerFactory.getLogger(OF13Provider.class); + private static final Logger LOG = LoggerFactory.getLogger(OF13Provider.class); private static final short TABLE_0_DEFAULT_INGRESS = 0; private static final short TABLE_1_ISOLATE_TENANT = 10; private static final short TABLE_2_LOCAL_FORWARD = 20; @@ -127,7 +130,6 @@ public class OF13Provider implements ConfigInterface, NetworkingProvider { private volatile L2ForwardingProvider l2ForwardingProvider; public static final String NAME = "OF13Provider"; - private volatile NetworkingProviderManager networkingProviderManager; private volatile BundleContext bundleContext; private volatile Southbound southbound; @@ -150,20 +152,22 @@ public class OF13Provider implements ConfigInterface, NetworkingProvider { return false; } + // The method is tested for in OF13ProviderTest + @SuppressWarnings("unused") private Status getTunnelReadinessStatus (Node node, String tunnelKey) { InetAddress srcTunnelEndPoint = configurationService.getTunnelEndPoint(node); if (srcTunnelEndPoint == null) { - logger.error("Tunnel Endpoint not configured for Node {}", node); + LOG.error("Tunnel Endpoint not configured for Node {}", node); return new Status(StatusCode.NOTFOUND, "Tunnel Endpoint not configured for "+ node); } if (!bridgeConfigurationManager.isNodeNeutronReady(node)) { - logger.error(node+" is not Overlay ready"); + LOG.error("{} is not Overlay ready", node); return new Status(StatusCode.NOTACCEPTABLE, node+" is not Overlay ready"); } if (!tenantNetworkManager.isTenantNetworkPresentInNode(node, tunnelKey)) { - logger.debug(node + " has no VM corresponding to segment " + tunnelKey); + LOG.debug("{} has no VM corresponding to segment {}", node, tunnelKey); return new Status(StatusCode.NOTACCEPTABLE, node+" has no VM corresponding to segment "+ tunnelKey); } return new Status(StatusCode.SUCCESS); @@ -176,10 +180,10 @@ public class OF13Provider implements ConfigInterface, NetworkingProvider { private boolean addTunnelPort (Node node, String tunnelType, InetAddress src, InetAddress dst) { String tunnelBridgeName = configurationService.getIntegrationBridgeName(); String portName = getTunnelName(tunnelType, dst); - logger.info("addTunnelPort enter: portName: {}", portName); + LOG.info("addTunnelPort enter: portName: {}", portName); if (southbound.extractTerminationPointAugmentation(node, portName) != null || southbound.isTunnelTerminationPointExist(node, tunnelBridgeName, portName)) { - logger.info("Tunnel {} is present in {} of {}", portName, tunnelBridgeName, node.getNodeId().getValue()); + LOG.info("Tunnel {} is present in {} of {}", portName, tunnelBridgeName, node.getNodeId().getValue()); return true; } @@ -189,11 +193,11 @@ public class OF13Provider implements ConfigInterface, NetworkingProvider { options.put("remote_ip", dst.getHostAddress()); if (!southbound.addTunnelTerminationPoint(node, tunnelBridgeName, portName, tunnelType, options)) { - logger.error("Failed to insert Tunnel port {} in {}", portName, tunnelBridgeName); + LOG.error("Failed to insert Tunnel port {} in {}", portName, tunnelBridgeName); return false; } - logger.info("addTunnelPort exit: portName: {}", portName); + LOG.info("addTunnelPort exit: portName: {}", portName); return true; } @@ -688,31 +692,22 @@ public class OF13Provider implements ConfigInterface, NetworkingProvider { handleVlanMiss(dpid, TABLE_1_ISOLATE_TENANT, TABLE_2_LOCAL_FORWARD, segmentationId, ethPort, false); } - private Long getDpid(Node node) { - Long dpid = 0L; - dpid = southbound.getDataPathId(node); + private long getDpid(Node node) { + long dpid = southbound.getDataPathId(node); if (dpid == 0) { - logger.warn("getDpid: dpid not found: {}", node); + LOG.warn("getDpid: dpid not found: {}", node); } return dpid; } - private Long getIntegrationBridgeOFDPID(Node node) { - Long dpid = 0L; + private long getIntegrationBridgeOFDPID(Node node) { + long dpid = 0L; if (southbound.getBridgeName(node).equals(configurationService.getIntegrationBridgeName())) { dpid = getDpid(node); } return dpid; } - private Long getExternalBridgeDpid(Node node) { - Long dpid = 0L; - if (southbound.getBridgeName(node).equals(configurationService.getExternalBridgeName())) { - dpid = getDpid(node); - } - return dpid; - } - /** * Returns true is the network if of type GRE or VXLAN * @@ -722,7 +717,7 @@ public class OF13Provider implements ConfigInterface, NetworkingProvider { private boolean isTunnel(String networkType) { return (networkType.equalsIgnoreCase(NetworkHandler.NETWORK_TYPE_GRE) || networkType.equalsIgnoreCase - (NetworkHandler.NETWORK_TYPE_VXLAN))? true:false; + (NetworkHandler.NETWORK_TYPE_VXLAN)); } /** @@ -733,145 +728,89 @@ public class OF13Provider implements ConfigInterface, NetworkingProvider { */ private boolean isVlan(String networkType) { - return networkType.equalsIgnoreCase(NetworkHandler.NETWORK_TYPE_VLAN)? true:false; + return networkType.equalsIgnoreCase(NetworkHandler.NETWORK_TYPE_VLAN); } - private void programLocalRules (String networkType, String segmentationId, Node node, + private void programLocalRules(String networkType, String segmentationId, Node node, OvsdbTerminationPointAugmentation intf) { - logger.debug("programLocalRules: node: {}, intf: {}, networkType: {}, segmentationId: {}", + LOG.debug("programLocalRules: node: {}, intf: {}, networkType: {}, segmentationId: {}", node.getNodeId(), intf.getName(), networkType, segmentationId); try { - Long dpid = getIntegrationBridgeOFDPID(node); + long dpid = getIntegrationBridgeOFDPID(node); if (dpid == 0L) { - logger.debug("programLocalRules: Openflow Datapath-ID not set for the integration bridge in {}", + LOG.debug("programLocalRules: Openflow Datapath-ID not set for the integration bridge in {}", node); return; } long localPort = southbound.getOFPort(intf); if (localPort == 0) { - logger.info("programLocalRules: could not find ofPort for Port {} on Node {}",intf.getName(), node.getNodeId()); + LOG.info("programLocalRules: could not find ofPort for Port {} on Node {}", + intf.getName(), node.getNodeId()); return; } String attachedMac = southbound.getInterfaceExternalIdsValue(intf, Constants.EXTERNAL_ID_VM_MAC); if (attachedMac == null) { - logger.warn("No AttachedMac seen in {}", intf); + LOG.warn("No AttachedMac seen in {}", intf); return; } /* Program local rules based on network type */ if (isVlan(networkType)) { - logger.debug("Program local vlan rules for interface {}", intf.getName()); + LOG.debug("Program local vlan rules for interface {}", intf.getName()); programLocalVlanRules(node, dpid, segmentationId, attachedMac, localPort); } - if ((isTunnel(networkType)|| isVlan(networkType))) { - logger.debug("programLocalRules: Program fixed security group rules for interface {}", intf.getName()); - // Get the DHCP port for the subnet to which the interface belongs to. - NeutronPort dhcpPort = securityServicesManager.getDHCPServerPort(intf); - if (null != dhcpPort) { - boolean isComputePort =securityServicesManager.isComputePort(intf); - boolean isLastPortinBridge = securityServicesManager.isLastPortinBridge(node, intf); - boolean isLastPortinSubnet =false; - List srcAddressList = null; - if(isComputePort) { - isLastPortinSubnet = securityServicesManager.isLastPortinSubnet(node, intf); - srcAddressList = securityServicesManager.getIpAddress(node, intf); - if (null == srcAddressList) { - logger.warn("programLocalRules: No Ip address assigned {}", intf); - return; - } - } - ingressAclProvider.programFixedSecurityACL(dpid,segmentationId, dhcpPort.getMacAddress(), localPort, - isLastPortinSubnet,isComputePort, true); - egressAclProvider.programFixedSecurityACL(dpid, segmentationId, attachedMac, localPort, - srcAddressList, isLastPortinBridge, isComputePort,true); - } else { - logger.warn("programLocalRules: No DCHP port seen in network of {}", intf); - } + if ((isTunnel(networkType) || isVlan(networkType))) { + programLocalSecurityGroupRules(attachedMac, node, intf, dpid, localPort, segmentationId, true); } - /* If the network type is tunnel based (VXLAN/GRRE/etc) with Neutron Port Security ACLs */ - /* TODO SB_MIGRATION */ - /*if ((networkType.equalsIgnoreCase(NetworkHandler.NETWORK_TYPE_GRE) || networkType.equalsIgnoreCase - (NetworkHandler.NETWORK_TYPE_VXLAN)) && securityServicesManager.isPortSecurityReady(intf)) { - logger.debug("Neutron port has a Port Security Group"); - // Retrieve the security group UUID from the Neutron Port - NeutronSecurityGroup securityGroupInPort = securityServicesManager.getSecurityGroupInPort(intf); - logger.debug("Program Local rules for networkType: {} does contain a Port Security Group: {} " + - "to be installed on DPID: {}", networkType, securityGroupInPort, dpid); - ingressAclProvider.programPortSecurityACL(dpid, segmentationId, attachedMac, localPort, - securityGroupInPort); - egressAclProvider.programPortSecurityACL(dpid, segmentationId, attachedMac, localPort, - securityGroupInPort); - }*/ if (isTunnel(networkType)) { - logger.debug("Program local bridge rules for interface {}, " - + "dpid: {}, segmentationId: {}, attachedMac: {}, localPort: {}", + LOG.debug("Program local bridge rules for interface {}, " + + "dpid: {}, segmentationId: {}, attachedMac: {}, localPort: {}", intf.getName(), dpid, segmentationId, attachedMac, localPort); programLocalBridgeRules(node, dpid, segmentationId, attachedMac, localPort); } } catch (Exception e) { - logger.error("Exception in programming Local Rules for "+intf+" on "+node, e); + LOG.error("Exception in programming Local Rules for " + intf + " on " + node, e); } } - private void removeLocalRules (String networkType, String segmentationId, Node node, + private void removeLocalRules(String networkType, String segmentationId, Node node, OvsdbTerminationPointAugmentation intf) { - logger.debug("removeLocalRules: node: {}, intf: {}, networkType: {}, segmentationId: {}", + LOG.debug("removeLocalRules: node: {}, intf: {}, networkType: {}, segmentationId: {}", node.getNodeId(), intf.getName(), networkType, segmentationId); try { - Long dpid = getIntegrationBridgeOFDPID(node); + long dpid = getIntegrationBridgeOFDPID(node); if (dpid == 0L) { - logger.debug("removeLocalRules: Openflow Datapath-ID not set for the integration bridge in {}", node); + LOG.debug("removeLocalRules: Openflow Datapath-ID not set for the integration bridge in {}", node); return; } long localPort = southbound.getOFPort(intf); if (localPort == 0) { - logger.info("removeLocalRules: could not find ofPort"); + LOG.info("removeLocalRules: could not find ofPort"); return; } String attachedMac = southbound.getInterfaceExternalIdsValue(intf, Constants.EXTERNAL_ID_VM_MAC); if (attachedMac == null) { - logger.warn("No AttachedMac seen in {}", intf); + LOG.warn("No AttachedMac seen in {}", intf); return; } /* Program local rules based on network type */ if (isVlan(networkType)) { - logger.debug("Remove local vlan rules for interface {}", intf.getName()); + LOG.debug("Remove local vlan rules for interface {}", intf.getName()); removeLocalVlanRules(node, dpid, segmentationId, attachedMac, localPort); } else if (isTunnel(networkType)) { - logger.debug("Remove local bridge rules for interface {}", intf.getName()); + LOG.debug("Remove local bridge rules for interface {}", intf.getName()); removeLocalBridgeRules(node, dpid, segmentationId, attachedMac, localPort); } - if (isTunnel(networkType)|| isVlan(networkType)) { - logger.debug("removeLocalRules: Remove fixed security group rules for interface {}", intf.getName()); - NeutronPort dhcpPort = securityServicesManager.getDHCPServerPort(intf); - if (null != dhcpPort) { - List srcAddressList = securityServicesManager.getIpAddress(node, intf); - if (null == srcAddressList) { - logger.warn("removeLocalRules: No Ip address assigned {}", intf); - return; - } - boolean isLastPortinBridge = securityServicesManager.isLastPortinBridge(node, intf); - boolean isComputePort =securityServicesManager.isComputePort(intf); - boolean isLastPortinSubnet =false; - if (isComputePort) - { - isLastPortinSubnet = securityServicesManager.isLastPortinSubnet(node, intf); - } - ingressAclProvider.programFixedSecurityACL(dpid, segmentationId, dhcpPort.getMacAddress(), localPort, - isLastPortinSubnet, isComputePort, false); - egressAclProvider.programFixedSecurityACL(dpid, segmentationId, attachedMac, localPort, - srcAddressList, isLastPortinBridge, isComputePort, false); - }else{ - logger.warn("removeLocalRules: No DCHP port seen in network of {}", intf); - } + if (isTunnel(networkType) || isVlan(networkType)) { + programLocalSecurityGroupRules(attachedMac, node, intf, dpid, localPort, segmentationId, false); } } catch (Exception e) { - logger.error("Exception in removing Local Rules for "+intf+" on "+node, e); + LOG.error("Exception in removing Local Rules for " + intf + " on " + node, e); } } @@ -881,25 +820,25 @@ public class OF13Provider implements ConfigInterface, NetworkingProvider { // so we don't see those updates in this case - we only see the new nodes interface updates. private void programTunnelRules (String tunnelType, String segmentationId, InetAddress dst, Node node, OvsdbTerminationPointAugmentation intf, boolean local) { - logger.debug("programTunnelRules: node: {}, intf: {}, local: {}, tunnelType: {}, " - + "segmentationId: {}, dstAddr: {}", + LOG.debug("programTunnelRules: node: {}, intf: {}, local: {}, tunnelType: {}, " + + "segmentationId: {}, dstAddr: {}", node.getNodeId(), intf.getName(), local, tunnelType, segmentationId, dst.getHostAddress()); try { - Long dpid = getIntegrationBridgeOFDPID(node); + long dpid = getIntegrationBridgeOFDPID(node); if (dpid == 0L) { - logger.debug("programTunnelRules: Openflow Datapath-ID not set for the integration bridge in {}", node); + LOG.debug("programTunnelRules: Openflow Datapath-ID not set for the integration bridge in {}", node); return; } long localPort = southbound.getOFPort(intf); if (localPort == 0) { - logger.info("programTunnelRules: could not find ofPort for Port {} on Node{}",intf.getName(),node.getNodeId()); + LOG.info("programTunnelRules: could not find ofPort for Port {} on Node{}", intf.getName(), node.getNodeId()); return; } String attachedMac = southbound.getInterfaceExternalIdsValue(intf, Constants.EXTERNAL_ID_VM_MAC); if (attachedMac == null) { - logger.warn("programTunnelRules: No AttachedMac seen in {}", intf); + LOG.warn("programTunnelRules: No AttachedMac seen in {}", intf); return; } @@ -907,55 +846,52 @@ public class OF13Provider implements ConfigInterface, NetworkingProvider { if(tunnelPort != null){ long tunnelOFPort = southbound.getOFPort(tunnelPort); if (tunnelOFPort == 0) { - logger.error("programTunnelRules: Could not Identify Tunnel port {} -> OF ({}) on {}", + LOG.error("programTunnelRules: Could not Identify Tunnel port {} -> OF ({}) on {}", tunnelPort.getName(), tunnelOFPort, node); return; } - logger.debug("programTunnelRules: Identified Tunnel port {} -> OF ({}) on {}", + LOG.debug("programTunnelRules: Identified Tunnel port {} -> OF ({}) on {}", tunnelPort.getName(), tunnelOFPort, node); if (!local) { - logger.trace("programTunnelRules: program remote egress tunnel rules: node {}, intf {}", - node.getNodeId().getValue(), intf.getName()); + LOG.trace("programTunnelRules: program remote egress tunnel rules: node {}, intf {}", + node.getNodeId().getValue(), intf.getName()); programRemoteEgressTunnelBridgeRules(node, dpid, segmentationId, attachedMac, tunnelOFPort, localPort); - } - - if (local) { - logger.trace("programTunnelRules: program local ingress tunnel rules: node {}, intf {}", + } else { + LOG.trace("programTunnelRules: program local ingress tunnel rules: node {}, intf {}", node.getNodeId().getValue(), intf.getName()); programLocalIngressTunnelBridgeRules(node, dpid, segmentationId, attachedMac, tunnelOFPort, localPort); } - return; } } catch (Exception e) { - logger.trace("", e); + LOG.trace("", e); } } private void removeTunnelRules (String tunnelType, String segmentationId, InetAddress dst, Node node, OvsdbTerminationPointAugmentation intf, boolean local, boolean isLastInstanceOnNode) { - logger.debug("removeTunnelRules: node: {}, intf: {}, local: {}, tunnelType: {}, " + LOG.debug("removeTunnelRules: node: {}, intf: {}, local: {}, tunnelType: {}, " + "segmentationId: {}, dstAddr: {}, isLastinstanceOnNode: {}", node.getNodeId(), intf.getName(), local, tunnelType, segmentationId, dst, isLastInstanceOnNode); try { - Long dpid = getIntegrationBridgeOFDPID(node); + long dpid = getIntegrationBridgeOFDPID(node); if (dpid == 0L) { - logger.debug("removeTunnelRules: Openflow Datapath-ID not set for the integration bridge in {}", node); + LOG.debug("removeTunnelRules: Openflow Datapath-ID not set for the integration bridge in {}", node); return; } long localPort = southbound.getOFPort(intf); if (localPort == 0) { - logger.info("removeTunnelRules: could not find ofPort"); + LOG.info("removeTunnelRules: could not find ofPort"); return; } String attachedMac = southbound.getInterfaceExternalIdsValue(intf, Constants.EXTERNAL_ID_VM_MAC); if (attachedMac == null) { - logger.error("removeTunnelRules: No AttachedMac seen in {}", intf); + LOG.error("removeTunnelRules: No AttachedMac seen in {}", intf); return; } @@ -964,11 +900,11 @@ public class OF13Provider implements ConfigInterface, NetworkingProvider { if (tunIntf.getName().equals(getTunnelName(tunnelType, dst))) { long tunnelOFPort = southbound.getOFPort(tunIntf); if (tunnelOFPort == 0) { - logger.error("Could not Identify Tunnel port {} -> OF ({}) on {}", + LOG.error("Could not Identify Tunnel port {} -> OF ({}) on {}", tunIntf.getName(), tunnelOFPort, node); return; } - logger.debug("Identified Tunnel port {} -> OF ({}) on {}", + LOG.debug("Identified Tunnel port {} -> OF ({}) on {}", tunIntf.getName(), tunnelOFPort, node); if (!local) { @@ -982,28 +918,28 @@ public class OF13Provider implements ConfigInterface, NetworkingProvider { } } } catch (Exception e) { - logger.error("", e); + LOG.error("", e); } } private void programVlanRules (NeutronNetwork network, Node node, OvsdbTerminationPointAugmentation intf) { - logger.debug("programVlanRules: node: {}, network: {}, intf: {}", + LOG.debug("programVlanRules: node: {}, network: {}, intf: {}", node.getNodeId(), network.getNetworkUUID(), intf.getName()); - Long dpid = getIntegrationBridgeOFDPID(node); + long dpid = getIntegrationBridgeOFDPID(node); if (dpid == 0L) { - logger.debug("programVlanRules: Openflow Datapath-ID not set for the integration bridge in {}", node); + LOG.debug("programVlanRules: Openflow Datapath-ID not set for the integration bridge in {}", node); return; } long localPort = southbound.getOFPort(intf); if (localPort == 0) { - logger.debug("programVlanRules: could not find ofPort for {}", intf.getName()); + LOG.debug("programVlanRules: could not find ofPort for {}", intf.getName()); return; } String attachedMac = southbound.getInterfaceExternalIdsValue(intf, Constants.EXTERNAL_ID_VM_MAC); if (attachedMac == null) { - logger.debug("programVlanRules: No AttachedMac seen in {}", intf); + LOG.debug("programVlanRules: No AttachedMac seen in {}", intf); return; } @@ -1011,10 +947,10 @@ public class OF13Provider implements ConfigInterface, NetworkingProvider { bridgeConfigurationManager.getPhysicalInterfaceName(node, network.getProviderPhysicalNetwork()); long ethOFPort = southbound.getOFPort(node, phyIfName); if (ethOFPort == 0) { - logger.warn("programVlanRules: could not find ofPort for physical port {}", phyIfName); + LOG.warn("programVlanRules: could not find ofPort for physical port {}", phyIfName); return; } - logger.debug("programVlanRules: Identified eth port {} -> ofPort ({}) on {}", + LOG.debug("programVlanRules: Identified eth port {} -> ofPort ({}) on {}", phyIfName, ethOFPort, node); // TODO: add logic to only add rule on remote nodes programRemoteEgressVlanRules(node, dpid, network.getProviderSegmentationID(), @@ -1025,23 +961,23 @@ public class OF13Provider implements ConfigInterface, NetworkingProvider { private void removeVlanRules (NeutronNetwork network, Node node, OvsdbTerminationPointAugmentation intf, boolean isLastInstanceOnNode) { - logger.debug("removeVlanRules: node: {}, network: {}, intf: {}, isLastInstanceOnNode", + LOG.debug("removeVlanRules: node: {}, network: {}, intf: {}, isLastInstanceOnNode", node.getNodeId(), network.getNetworkUUID(), intf.getName(), isLastInstanceOnNode); - Long dpid = getIntegrationBridgeOFDPID(node); + long dpid = getIntegrationBridgeOFDPID(node); if (dpid == 0L) { - logger.debug("removeVlanRules: Openflow Datapath-ID not set for the integration bridge in {}", node); + LOG.debug("removeVlanRules: Openflow Datapath-ID not set for the integration bridge in {}", node); return; } long localPort = southbound.getOFPort(intf); if (localPort == 0) { - logger.debug("removeVlanRules: programVlanRules: could not find ofPort for {}", intf.getName()); + LOG.debug("removeVlanRules: programVlanRules: could not find ofPort for {}", intf.getName()); return; } String attachedMac = southbound.getInterfaceExternalIdsValue(intf, Constants.EXTERNAL_ID_VM_MAC); if (attachedMac == null) { - logger.debug("removeVlanRules: No AttachedMac seen in {}", intf); + LOG.debug("removeVlanRules: No AttachedMac seen in {}", intf); return; } @@ -1049,10 +985,10 @@ public class OF13Provider implements ConfigInterface, NetworkingProvider { bridgeConfigurationManager.getPhysicalInterfaceName(node, network.getProviderPhysicalNetwork()); long ethOFPort = southbound.getOFPort(node, phyIfName); if (ethOFPort == 0) { - logger.warn("removeVlanRules: could not find ofPort for physical port {}", phyIfName); + LOG.warn("removeVlanRules: could not find ofPort for physical port {}", phyIfName); return; } - logger.debug("removeVlanRules: Identified eth port {} -> ofPort ({}) on {}", + LOG.debug("removeVlanRules: Identified eth port {} -> ofPort ({}) on {}", phyIfName, ethOFPort, node); removeRemoteEgressVlanRules(node, dpid, network.getProviderSegmentationID(), @@ -1062,6 +998,108 @@ public class OF13Provider implements ConfigInterface, NetworkingProvider { } } + private void programLocalSecurityGroupRules(String attachedMac, Node node, OvsdbTerminationPointAugmentation intf, + Long dpid,long localPort, String segmentationId, + boolean write) { + + LOG.debug("programLocalRules: Program fixed security group rules for interface {}", intf.getName()); + NeutronPort dhcpPort = securityServicesManager.getDhcpServerPort(intf); + boolean isComputePort = false; + boolean isLastPortinBridge = false; + boolean isLastPortinSubnet = false; + List srcAddressList = null; + if (null != dhcpPort) { + isComputePort = securityServicesManager.isComputePort(intf); + isLastPortinBridge = securityServicesManager.isLastPortinBridge(node, intf); + isLastPortinSubnet = false; + if (isComputePort) { + isLastPortinSubnet = securityServicesManager.isLastPortinSubnet(node, intf); + srcAddressList = securityServicesManager.getIpAddressList(node, intf); + if (null == srcAddressList) { + LOG.warn("programLocalRules: No Ip address assigned {}", intf); + return; + } + } + ingressAclProvider.programFixedSecurityAcl(dpid, segmentationId, dhcpPort.getMacAddress(), localPort, + isLastPortinSubnet, isComputePort, write); + egressAclProvider.programFixedSecurityAcl(dpid, segmentationId, attachedMac, localPort, + srcAddressList, isLastPortinBridge, isComputePort,write); + /* If the network type is tunnel based (VXLAN/GRRE/etc) with Neutron Port Security ACLs */ + /* TODO SB_MIGRATION */ + + LOG.debug("Neutron port has a Port Security Group"); + // Retrieve the security group from the Neutron Port and apply the rules + if (securityServicesManager.isPortSecurityReady(intf)) { + //Associate the security group flows. + List securityGroupListInPort = securityServicesManager + .getSecurityGroupInPortList(intf); + for (NeutronSecurityGroup securityGroupInPort:securityGroupListInPort) { + ingressAclProvider.programPortSecurityAcl(dpid, segmentationId, attachedMac, localPort, + securityGroupInPort,srcAddressList, write); + egressAclProvider.programPortSecurityAcl(dpid, segmentationId, attachedMac, localPort, + securityGroupInPort,srcAddressList, write); + } + } + } else { + LOG.warn("programLocalRules: No DCHP port seen in network of {}", intf); + } + } + + /* + * The function is for the new compute node joining the existing network. + * When a new VM is instantiated in the new compute node, neutron port add + * event is generated. This event is processed only for that node. So, + * loop through all the ports of the same network and install unicast mac + * flow for the VM's created on the TEP of the destination node in src node. + * This function will be executed even for any new VM creation in an existing + * network. If a cache is maintained to optimize the below flow addition, it will + * work only for one unstack and restack. For the next unstack and restack, + * it will not work since the cache would have been already deleted. + */ + private void programTunnelRulesInNewNode(NeutronNetwork network, + String networkType, String segmentationId, + InetAddress src, InetAddress dst, + Node srcBridgeNode, Node dstBridgeNode, + OvsdbTerminationPointAugmentation intf){ + try { + long localPort = southbound.getOFPort(intf); + if(localPort != 0) + { + LOG.debug("Interface update details {}", intf); + + /* + * When a network is added and the TEP destination is not present in a + * node C1, tunnelin and broadcast rules will not be programmed, since + * OF port is not created. So, when a new node C2 joins and create a new + * VM, the tunnelin and broadcast rule will not be present in C1. + * So, handling it in the case below to make ping work. + */ + if(securityServicesManager.getNeutronPortFromDhcpIntf(intf) == null){ + programTunnelRules(networkType, segmentationId, src, dstBridgeNode, intf, true); + } + + /* + * FIX for 4208 - loop through all the ports and add the VM's + * unicast mac rule of the destination node in the source node. + * When a new node is added, it needs to configure the VM unicast mac + * flow rules which were created before it was joined to an existing + * network. + */ + List ports = southbound.getTerminationPointsOfBridge(dstBridgeNode); + for (OvsdbTerminationPointAugmentation port : ports) { + if(network == tenantNetworkManager.getTenantNetwork(port)){ + programTunnelRules(networkType, segmentationId, dst, srcBridgeNode, port, false); + } + else{ + LOG.trace("Port {} is not part of network {}", port, network); + } + } + } + } catch (Exception e) { + LOG.error("Exception during handlingNeutron network add", e); + } + } + @Override public boolean handleInterfaceUpdate(NeutronNetwork network, Node srcNode, OvsdbTerminationPointAugmentation intf) { @@ -1098,9 +1136,11 @@ public class OF13Provider implements ConfigInterface, NetworkingProvider { } if (destTunnelStatus) { programTunnelRules(networkType, segmentationId, src, dstBridgeNode, intf, false); + programTunnelRulesInNewNode(network, networkType, segmentationId, src, dst, + srcBridgeNode, dstBridgeNode, intf); } } else { - logger.warn("Tunnel end-point configuration missing. Please configure it in OpenVSwitch Table. " + LOG.warn("Tunnel end-point configuration missing. Please configure it in OpenVSwitch Table. " + "Check source {} or destination {}", src != null ? src.getHostAddress() : "null", dst != null ? dst.getHostAddress() : "null"); @@ -1112,20 +1152,20 @@ public class OF13Provider implements ConfigInterface, NetworkingProvider { } private void triggerInterfaceUpdates(Node node) { - logger.debug("enter triggerInterfaceUpdates for {}", node.getNodeId()); + LOG.debug("enter triggerInterfaceUpdates for {}", node.getNodeId()); List ports = southbound.extractTerminationPointAugmentations(node); if (ports != null && !ports.isEmpty()) { for (OvsdbTerminationPointAugmentation port : ports) { NeutronNetwork neutronNetwork = tenantNetworkManager.getTenantNetwork(port); if (neutronNetwork != null) { - logger.warn("Trigger Interface update for {}", port); + LOG.warn("Trigger Interface update for {}", port); handleInterfaceUpdate(neutronNetwork, node, port); } } } else { - logger.warn("triggerInterfaceUpdates: tps are null"); + LOG.warn("triggerInterfaceUpdates: tps are null"); } - logger.debug("exit triggerInterfaceUpdates for {}", node.getNodeId()); + LOG.debug("exit triggerInterfaceUpdates for {}", node.getNodeId()); } @Override @@ -1135,7 +1175,7 @@ public class OF13Provider implements ConfigInterface, NetworkingProvider { nodeCacheManager.getOvsdbNodes(); nodes.remove(southbound.extractBridgeOvsdbNodeId(srcNode)); - logger.info("Delete intf " + intf.getName() + " isLastInstanceOnNode " + isLastInstanceOnNode); + LOG.info("Delete intf " + intf.getName() + " isLastInstanceOnNode " + isLastInstanceOnNode); List phyIfName = bridgeConfigurationManager.getAllPhysicalInterfaceNames(srcNode); if (southbound.isTunnel(intf)) { // Delete tunnel port @@ -1148,7 +1188,7 @@ public class OF13Provider implements ConfigInterface, NetworkingProvider { MdsalHelper.createOvsdbInterfaceType(intf.getInterfaceType()), src, dst); } catch (Exception e) { - logger.error(e.getMessage(), e); + LOG.error(e.getMessage(), e); } } else if (phyIfName.contains(intf.getName())) { deletePhysicalPort(srcNode, intf.getName()); @@ -1165,21 +1205,21 @@ public class OF13Provider implements ConfigInterface, NetworkingProvider { InetAddress src = configurationService.getTunnelEndPoint(srcNode); InetAddress dst = configurationService.getTunnelEndPoint(dstNode); if ((src != null) && (dst != null)) { - logger.info("Remove tunnel rules for interface " + LOG.info("Remove tunnel rules for interface " + intf.getName() + " on srcNode " + srcNode.getNodeId().getValue()); removeTunnelRules(tunnelType, network.getProviderSegmentationID(), dst, srcNode, intf, true, isLastInstanceOnNode); Node dstBridgeNode = southbound.getBridgeNode(dstNode, Constants.INTEGRATION_BRIDGE); if(dstBridgeNode != null){ - logger.info("Remove tunnel rules for interface " + LOG.info("Remove tunnel rules for interface " + intf.getName() + " on dstNode " + dstNode.getNodeId().getValue()); removeTunnelRules(tunnelType, network.getProviderSegmentationID(), src, dstBridgeNode, intf, false, isLastInstanceOnNode); } } else { - logger.warn("Tunnel end-point configuration missing. Please configure it in " - + "OpenVSwitch Table. " - + "Check source {} or destination {}", + LOG.warn("Tunnel end-point configuration missing. Please configure it in " + + "OpenVSwitch Table. " + + "Check source {} or destination {}", src != null ? src.getHostAddress() : "null", dst != null ? dst.getHostAddress() : "null"); } @@ -1199,11 +1239,11 @@ public class OF13Provider implements ConfigInterface, NetworkingProvider { private void initializeFlowRules(Node node, String bridgeName) { Long dpid = southbound.getDataPathId(node); String datapathId = southbound.getDatapathId(node); - logger.info("initializeFlowRules: bridgeName: {}, dpid: {} - {}", + LOG.info("initializeFlowRules: bridgeName: {}, dpid: {} - {}", bridgeName, dpid, datapathId); if (dpid == 0L) { - logger.debug("Openflow Datapath-ID not set for the integration bridge in {}", node); + LOG.debug("Openflow Datapath-ID not set for the integration bridge in {}", node); return; } @@ -1367,7 +1407,8 @@ public class OF13Provider implements ConfigInterface, NetworkingProvider { * table=1,vlan_id=0x5,dl_dst=00:00:00:00:00:08 \ * actions= goto_table:2" */ - + // TODO This method is referenced from commented code above (which needs to be checked) + @SuppressWarnings("unused") private void handleVlanOut(Long dpidLong, Short writeTable, Short goToTableId, String segmentationId, Long ethPort, String attachedMac, boolean write) { @@ -1395,7 +1436,8 @@ public class OF13Provider implements ConfigInterface, NetworkingProvider { * Example: table=1,priority=16384,vlan_id=0x5,dl_dst=ff:ff:ff:ff:ff:ff \ * actions=output:eth1,goto_table:2 */ - + // TODO This method is referenced from commented code above (which needs to be checked) + @SuppressWarnings("unused") private void handleVlanFloodOut(Long dpidLong, Short writeTable, Short localTable, String segmentationId, Long localPort, Long ethPort, boolean write) { @@ -1500,7 +1542,8 @@ public class OF13Provider implements ConfigInterface, NetworkingProvider { * Action: Drop w/ a low priority * table=2,priority=8192,vlan_id=0x5 actions=drop */ - + // TODO This method is referenced from commented code above (which needs to be checked) + @SuppressWarnings("unused") private void handleLocalVlanTableMiss(Long dpidLong, Short writeTable, String segmentationId, boolean write) { l2ForwardingProvider.programLocalVlanTableMiss(dpidLong, segmentationId, write); @@ -1517,10 +1560,10 @@ public class OF13Provider implements ConfigInterface, NetworkingProvider { return data.get(); } } catch (InterruptedException|ExecutionException e) { - logger.error(e.getMessage(), e); + LOG.error(e.getMessage(), e); } - logger.debug("Cannot find data for Group " + groupBuilder.getGroupName()); + LOG.debug("Cannot find data for Group " + groupBuilder.getGroupName()); return null; } @@ -1534,9 +1577,9 @@ public class OF13Provider implements ConfigInterface, NetworkingProvider { CheckedFuture commitFuture = modification.submit(); try { commitFuture.get(); // TODO: Make it async (See bug 1362) - logger.debug("Transaction success for write of Group "+groupBuilder.getGroupName()); + LOG.debug("Transaction success for write of Group " + groupBuilder.getGroupName()); } catch (InterruptedException|ExecutionException e) { - logger.error(e.getMessage(), e); + LOG.error(e.getMessage(), e); } } @@ -1550,31 +1593,12 @@ public class OF13Provider implements ConfigInterface, NetworkingProvider { try { commitFuture.get(); // TODO: Make it async (See bug 1362) - logger.debug("Transaction success for deletion of Group "+groupBuilder.getGroupName()); + LOG.debug("Transaction success for deletion of Group " + groupBuilder.getGroupName()); } catch (InterruptedException|ExecutionException e) { - logger.error(e.getMessage(), e); + LOG.error(e.getMessage(), e); } } - private Flow getFlow(FlowBuilder flowBuilder, NodeBuilder nodeBuilder) { - InstanceIdentifier path1 = InstanceIdentifier.builder(Nodes.class).child(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory - .rev130819.nodes.Node.class, nodeBuilder.getKey()).augmentation(FlowCapableNode.class).child(Table.class, - new TableKey(flowBuilder.getTableId())).child(Flow.class, flowBuilder.getKey()).build(); - - ReadOnlyTransaction readTx = dataBroker.newReadOnlyTransaction(); - try { - Optional data = readTx.read(LogicalDatastoreType.CONFIGURATION, path1).get(); - if (data.isPresent()) { - return data.get(); - } - } catch (InterruptedException|ExecutionException e) { - logger.error(e.getMessage(), e); - } - - logger.debug("Cannot find data for Flow " + flowBuilder.getFlowName()); - return null; - } - private void writeFlow(FlowBuilder flowBuilder, NodeBuilder nodeBuilder) { ReadWriteTransaction modification = dataBroker.newReadWriteTransaction(); InstanceIdentifier path1 = @@ -1591,30 +1615,9 @@ public class OF13Provider implements ConfigInterface, NetworkingProvider { CheckedFuture commitFuture = modification.submit(); try { commitFuture.get(); // TODO: Make it async (See bug 1362) - logger.debug("Transaction success for write of Flow "+flowBuilder.getFlowName()); - } catch (InterruptedException|ExecutionException e) { - logger.error(e.getMessage(), e); - } - } - - private void removeFlow(FlowBuilder flowBuilder, NodeBuilder nodeBuilder) { - WriteTransaction modification = dataBroker.newWriteOnlyTransaction(); - InstanceIdentifier path1 = InstanceIdentifier.builder(Nodes.class) - .child(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory - .rev130819.nodes.Node.class, nodeBuilder.getKey()) - .augmentation(FlowCapableNode.class).child(Table.class, - new TableKey(flowBuilder.getTableId())).child(Flow.class, flowBuilder.getKey()).build(); - //modification.delete(LogicalDatastoreType.OPERATIONAL, nodeBuilderToInstanceId(nodeBuilder)); - //modification.delete(LogicalDatastoreType.OPERATIONAL, path1); - //modification.delete(LogicalDatastoreType.CONFIGURATION, nodeBuilderToInstanceId(nodeBuilder)); - modification.delete(LogicalDatastoreType.CONFIGURATION, path1); - - CheckedFuture commitFuture = modification.submit(); - try { - commitFuture.get(); // TODO: Make it async (See bug 1362) - logger.debug("Transaction success for deletion of Flow "+flowBuilder.getFlowName()); + LOG.debug("Transaction success for write of Flow " + flowBuilder.getFlowName()); } catch (InterruptedException|ExecutionException e) { - logger.error(e.getMessage(), e); + LOG.error(e.getMessage(), e); } } @@ -1626,12 +1629,14 @@ public class OF13Provider implements ConfigInterface, NetworkingProvider { * @param port Long representing a port on a switch/node * @return ib InstructionBuilder Map with instructions */ + // TODO This method is referenced from commented code in L2ForwardingService (which needs to be checked) + @SuppressWarnings("unused") protected InstructionBuilder createOutputGroupInstructions(NodeBuilder nodeBuilder, InstructionBuilder ib, Long dpidLong, Long port , List instructions) { NodeConnectorId ncid = new NodeConnectorId(Constants.OPENFLOW_NODE_PREFIX + dpidLong + ":" + port); - logger.debug("createOutputGroupInstructions() Node Connector ID is - Type=openflow: DPID={} port={} existingInstructions={}", dpidLong, port, instructions); + LOG.debug("createOutputGroupInstructions() Node Connector ID is - Type=openflow: DPID={} port={} existingInstructions={}", dpidLong, port, instructions); List actionList = Lists.newArrayList(); ActionBuilder ab = new ActionBuilder(); @@ -1653,7 +1658,7 @@ public class OF13Provider implements ConfigInterface, NetworkingProvider { OutputActionBuilder oab = new OutputActionBuilder(); oab.setOutputNodeConnector(ncid); ab.setAction(new OutputActionCaseBuilder().setOutputAction(oab.build()).build()); - logger.debug("createOutputGroupInstructions(): output action {}", ab.build()); + LOG.debug("createOutputGroupInstructions(): output action {}", ab.build()); boolean addNew = true; boolean groupActionAdded = false; @@ -1671,19 +1676,19 @@ public class OF13Provider implements ConfigInterface, NetworkingProvider { groupBuilder.setGroupType(GroupTypes.GroupAll); groupBuilder.setKey(key); group = getGroup(groupBuilder, nodeBuilder); - logger.debug("createOutputGroupInstructions: group {}", group); + LOG.debug("createOutputGroupInstructions: group {}", group); break; } } - logger.debug("createOutputGroupInstructions: groupActionAdded {}", groupActionAdded); + LOG.debug("createOutputGroupInstructions: groupActionAdded {}", groupActionAdded); if (groupActionAdded) { /* modify the action bucket in group */ groupBuilder = new GroupBuilder(group); Buckets buckets = groupBuilder.getBuckets(); for (Bucket bucket : buckets.getBucket()) { List bucketActions = bucket.getAction(); - logger.debug("createOutputGroupInstructions: bucketActions {}", bucketActions); + LOG.debug("createOutputGroupInstructions: bucketActions {}", bucketActions); for (Action action : bucketActions) { if (action.getAction() instanceof OutputActionCase) { OutputActionCase opAction = (OutputActionCase)action.getAction(); @@ -1695,30 +1700,28 @@ public class OF13Provider implements ConfigInterface, NetworkingProvider { } } } - logger.debug("createOutputGroupInstructions: addNew {}", addNew); - if (addNew) { + LOG.debug("createOutputGroupInstructions: addNew {}", addNew); + if (addNew && !buckets.getBucket().isEmpty()) { /* the new output action is not in the bucket, add to bucket */ - if (!buckets.getBucket().isEmpty()) { - Bucket bucket = buckets.getBucket().get(0); - List bucketActionList = Lists.newArrayList(); - bucketActionList.addAll(bucket.getAction()); - /* set order for new action and add to action list */ - ab.setOrder(bucketActionList.size()); - ab.setKey(new ActionKey(bucketActionList.size())); - bucketActionList.add(ab.build()); - - /* set bucket and buckets list. Reset groupBuilder with new buckets.*/ - BucketsBuilder bucketsBuilder = new BucketsBuilder(); - List bucketList = Lists.newArrayList(); - BucketBuilder bucketBuilder = new BucketBuilder(); - bucketBuilder.setBucketId(new BucketId((long) 1)); - bucketBuilder.setKey(new BucketKey(new BucketId((long) 1))); - bucketBuilder.setAction(bucketActionList); - bucketList.add(bucketBuilder.build()); - bucketsBuilder.setBucket(bucketList); - groupBuilder.setBuckets(bucketsBuilder.build()); - logger.debug("createOutputGroupInstructions: bucketList {}", bucketList); - } + Bucket bucket = buckets.getBucket().get(0); + List bucketActionList = Lists.newArrayList(); + bucketActionList.addAll(bucket.getAction()); + /* set order for new action and add to action list */ + ab.setOrder(bucketActionList.size()); + ab.setKey(new ActionKey(bucketActionList.size())); + bucketActionList.add(ab.build()); + + /* set bucket and buckets list. Reset groupBuilder with new buckets.*/ + BucketsBuilder bucketsBuilder = new BucketsBuilder(); + List bucketList = Lists.newArrayList(); + BucketBuilder bucketBuilder = new BucketBuilder(); + bucketBuilder.setBucketId(new BucketId((long) 1)); + bucketBuilder.setKey(new BucketKey(new BucketId((long) 1))); + bucketBuilder.setAction(bucketActionList); + bucketList.add(bucketBuilder.build()); + bucketsBuilder.setBucket(bucketList); + groupBuilder.setBuckets(bucketsBuilder.build()); + LOG.debug("createOutputGroupInstructions: bucketList {}", bucketList); } } else { /* create group */ @@ -1759,8 +1762,8 @@ public class OF13Provider implements ConfigInterface, NetworkingProvider { groupId++; } - logger.debug("createOutputGroupInstructions: group {}", groupBuilder.build()); - logger.debug("createOutputGroupInstructions: actionList {}", actionList); + LOG.debug("createOutputGroupInstructions: group {}", groupBuilder.build()); + LOG.debug("createOutputGroupInstructions: actionList {}", actionList); if (addNew) { /* rewrite the group to group table */ @@ -1783,11 +1786,13 @@ public class OF13Provider implements ConfigInterface, NetworkingProvider { * @param port Long representing a port on a switch/node * @return ib InstructionBuilder Map with instructions */ + // TODO This method is referenced from commented code in L2ForwardingService (which needs to be checked) + @SuppressWarnings("unused") protected boolean removeOutputPortFromGroup(NodeBuilder nodeBuilder, InstructionBuilder ib, Long dpidLong, Long port , List instructions) { NodeConnectorId ncid = new NodeConnectorId(Constants.OPENFLOW_NODE_PREFIX + dpidLong + ":" + port); - logger.debug("removeOutputPortFromGroup() Node Connector ID is - Type=openflow: DPID={} port={} existingInstructions={}", dpidLong, port, instructions); + LOG.debug("removeOutputPortFromGroup() Node Connector ID is - Type=openflow: DPID={} port={} existingInstructions={}", dpidLong, port, instructions); List actionList = Lists.newArrayList(); ActionBuilder ab; @@ -1878,7 +1883,7 @@ public class OF13Provider implements ConfigInterface, NetworkingProvider { bucketList.add(bucketBuilder.build()); bucketsBuilder.setBucket(bucketList); groupBuilder.setBuckets(bucketsBuilder.build()); - logger.debug("removeOutputPortFromGroup: bucketList {}", bucketList); + LOG.debug("removeOutputPortFromGroup: bucketList {}", bucketList); writeGroup(groupBuilder, nodeBuilder); ApplyActionsBuilder aab = new ApplyActionsBuilder(); @@ -1899,15 +1904,15 @@ public class OF13Provider implements ConfigInterface, NetworkingProvider { @Override public void initializeOFFlowRules(Node openflowNode) { String bridgeName = southbound.getBridgeName(openflowNode); - logger.info("initializeOFFlowRules: bridgeName: {}", bridgeName); + LOG.info("initializeOFFlowRules: bridgeName: {}", bridgeName); if (bridgeName.equals(configurationService.getIntegrationBridgeName())) { initializeFlowRules(openflowNode, configurationService.getIntegrationBridgeName()); triggerInterfaceUpdates(openflowNode); } else if (bridgeName.equals(configurationService.getExternalBridgeName())) { initializeFlowRules(openflowNode, configurationService.getExternalBridgeName()); - logger.info("initializeOFFlowRules after writeFlow: bridgeName: {}", bridgeName); + LOG.info("initializeOFFlowRules after writeFlow: bridgeName: {}", bridgeName); triggerInterfaceUpdates(openflowNode); - logger.info("initializeOFFlowRules after triggerUpdates: bridgeName: {}", bridgeName); + LOG.info("initializeOFFlowRules after triggerUpdates: bridgeName: {}", bridgeName); } } @@ -1946,9 +1951,9 @@ public class OF13Provider implements ConfigInterface, NetworkingProvider { @Override public void setDependencies(Object impl) { if (impl instanceof NetworkingProviderManager) { - networkingProviderManager = (NetworkingProviderManager)impl; + NetworkingProviderManager networkingProviderManager = (NetworkingProviderManager) impl; networkingProviderManager.providerAdded( - bundleContext.getServiceReference(NetworkingProvider.class.getName()),this); + bundleContext.getServiceReference(NetworkingProvider.class.getName()), this); } } }