Added install and remove flows counters for Dhcp and SNAT default flows.
Change-Id: I2b4b6692675b4f22af600cb3edea6bf660462af6
Signed-off-by: yair <yair.zinger@hpe.com>
<karaf.shell.console.version>3.0.3</karaf.shell.console.version>
<neutron.version>0.7.0-SNAPSHOT</neutron.version>
<genius.version>0.1.0-SNAPSHOT</genius.version>
+ <infrautils.version>1.0.0-SNAPSHOT</infrautils.version>
</properties>
<dependencyManagement>
<artifactId>hwvtepsouthbound-api</artifactId>
<version>${vpns.ovsdb.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.opendaylight.infrautils</groupId>
+ <artifactId>counters-api</artifactId>
+ <version>${infrautils.version}</version>
+ </dependency>
</dependencies>
<!--
import org.opendaylight.netvirt.neutronvpn.interfaces.INeutronVpnManager;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.ServiceBindings;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.ServiceModeIngress;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.ServiceTypeFlowBased;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.StypeOpenflow;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.StypeOpenflowBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.service.bindings.ServicesInfo;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.service.bindings.ServicesInfoKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.ServiceModeIngress;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.service.bindings.services.info.BoundServices;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.service.bindings.services.info.BoundServicesBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.interfacemanager.servicebinding.rev160406.service.bindings.services.info.BoundServicesKey;
FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpId, DHCPMConstants.DHCP_TABLE, "DHCPTableMissFlow",
0, "DHCP Table Miss Flow", 0, 0,
DHCPMConstants.COOKIE_DHCP_BASE, matches, instructions);
+ DhcpServiceCounters.install_dhcp_table_miss_flow.inc();
mdsalUtil.installFlow(flowEntity);
setupTableMissForHandlingExternalTunnel(dpId);
}
FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpId, NwConstants.DHCP_TABLE_EXTERNAL_TUNNEL, "DHCPTableMissFlowForExternalTunnel",
0, "DHCP Table Miss Flow For External Tunnel", 0, 0,
DHCPMConstants.COOKIE_DHCP_BASE, matches, instructions);
+ DhcpServiceCounters.install_dhcp_table_miss_flow_for_external_table.inc();
mdsalUtil.installFlow(flowEntity);
}
--- /dev/null
+/*
+ * Copyright (c) 2016 Hewlett-Packard Enterprise 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.netvirt.dhcpservice;
+
+import org.opendaylight.infrautils.counters.api.OccurenceCounter;
+
+public enum DhcpServiceCounters {
+ install_dhcp_drop_flow, //
+ install_dhcp_flow, //
+ install_dhcp_table_miss_flow, //
+ install_dhcp_table_miss_flow_for_external_table, //
+ remove_dhcp_drop_flow, //
+ remove_dhcp_flow;
+
+ private OccurenceCounter counter;
+
+ private DhcpServiceCounters() {
+ counter = new OccurenceCounter(getClass().getEnclosingClass().getSimpleName(), name(), name());
+ }
+
+ public void inc() {
+ counter.inc();
+ }
+}
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.netvirt.dhcpservice.api.DHCPMConstants;
import org.opendaylight.genius.mdsalutil.ActionInfo;
import org.opendaylight.genius.mdsalutil.ActionType;
import org.opendaylight.genius.mdsalutil.FlowEntity;
import org.opendaylight.genius.mdsalutil.NwConstants;
import org.opendaylight.genius.mdsalutil.interfaces.IMdsalApiManager;
import org.opendaylight.genius.mdsalutil.packet.IPProtocols;
+import org.opendaylight.netvirt.dhcpservice.api.DHCPMConstants;
import org.opendaylight.netvirt.neutronvpn.api.utils.NeutronUtils;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.Interfaces;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.InterfacesState;
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.inventory.rev130819.nodes.Node;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.ElanDpnInterfaces;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.dpn.interfaces.ElanDpnInterfacesList;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.dpn.interfaces.ElanDpnInterfacesListKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.dpn.interfaces.elan.dpn.interfaces.list.DpnInterfaces;
import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.networks.rev150712.NetworkTypeVxlan;
import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.networks.rev150712.networks.attributes.Networks;
import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.networks.rev150712.networks.attributes.networks.Network;
import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.ports.attributes.Ports;
import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.ports.rev150712.ports.attributes.ports.Port;
import org.opendaylight.yang.gen.v1.urn.opendaylight.neutron.rev150712.Neutron;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.ElanDpnInterfaces;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.dpn.interfaces.ElanDpnInterfacesList;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.dpn.interfaces.ElanDpnInterfacesListKey;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.elan.rev150602.elan.dpn.interfaces.elan.dpn.interfaces.list.DpnInterfaces;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
DHCPMConstants.DEFAULT_DHCP_FLOW_PRIORITY, "DHCP", 0, 0,
DHCPMConstants.COOKIE_DHCP_BASE, matches, null);
logger.trace("Removing DHCP Flow DpId {}, vmMacAddress {}", dpId, vmMacAddress);
+ DhcpServiceCounters.remove_dhcp_flow.inc();
mdsalUtil.removeFlow(flowEntity);
} else {
FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpId, tableId,
getDhcpFlowRef(dpId, tableId, vmMacAddress),DHCPMConstants.DEFAULT_DHCP_FLOW_PRIORITY, "DHCP", 0, 0,
DHCPMConstants.COOKIE_DHCP_BASE, matches, instructions);
logger.trace("Installing DHCP Flow DpId {}, vmMacAddress {}", dpId, vmMacAddress);
+ DhcpServiceCounters.install_dhcp_flow.inc();
mdsalUtil.installFlow(flowEntity);
}
}
DHCPMConstants.DEFAULT_DHCP_FLOW_PRIORITY, "DHCP", 0, 0,
DHCPMConstants.COOKIE_DHCP_BASE, matches, null);
logger.trace("Removing DHCP Drop Flow DpId {}, vmMacAddress {}", dpId, vmMacAddress);
+ DhcpServiceCounters.remove_dhcp_drop_flow.inc();
mdsalUtil.removeFlow(flowEntity);
} else {
FlowEntity flowEntity = MDSALUtil.buildFlowEntity(dpId, tableId,
getDhcpFlowRef(dpId, tableId, vmMacAddress),DHCPMConstants.DEFAULT_DHCP_FLOW_PRIORITY, "DHCP", 0, 0,
DHCPMConstants.COOKIE_DHCP_BASE, matches, instructions);
logger.trace("Installing DHCP Drop Flow DpId {}, vmMacAddress {}", dpId, vmMacAddress);
+ DhcpServiceCounters.install_dhcp_drop_flow.inc();
mdsalUtil.installFlow(flowEntity);
}
}
<liblldp.version>0.11.0-SNAPSHOT</liblldp.version>
<neutron.version>0.7.0-SNAPSHOT</neutron.version>
<genius.version>0.1.0-SNAPSHOT</genius.version>
+ <infrautils.version>1.0.0-SNAPSHOT</infrautils.version>
<arputil.version>${genius.version}</arputil.version>
<mdsalutil.version>${genius.version}</mdsalutil.version>
<vpnmanager.version>${vpnservices.version}</vpnmanager.version>
<artifactId>statemanager-impl</artifactId>
<version>${vpnservices.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.opendaylight.infrautils</groupId>
+ <artifactId>infrautils-features</artifactId>
+ <version>${infrautils.version}</version>
+ <classifier>features</classifier>
+ <type>xml</type>
+ </dependency>
</dependencies>
<!--
<repository>mvn:org.opendaylight.neutron/features-neutron/{{VERSION}}/xml/features</repository>
<repository>mvn:org.opendaylight.ovsdb/hwvtepsouthbound-features/{{VERSION}}/xml/features</repository>
<repository>mvn:org.opendaylight.genius/genius-features/{{VERSION}}/xml/features</repository>
+ <repository>mvn:org.opendaylight.infrautils/infrautils-features/{{VERSION}}/xml/features</repository>
<feature name='odl-netvirt-api' version='${project.version}' description='OpenDaylight :: NetVirt :: api'>
<feature version='${mdsal.version}'>odl-mdsal-broker</feature>
<feature version="${ovsdb.version}">odl-ovsdb-southbound-api</feature>
<feature version='${ovsdb.version}'>odl-ovsdb-hwvtepsouthbound-api</feature>
<feature version='${genius.version}'>odl-genius-api</feature>
+ <feature version='${infrautils.version}'>odl-infrautils-counters</feature>
<bundle>mvn:org.opendaylight.controller/liblldp/{{VERSION}}</bundle>
<bundle>mvn:org.opendaylight.neutron/model/{{VERSION}}</bundle>
<bundle>mvn:org.opendaylight.netvirt/model-bgp/{{VERSION}}</bundle>
<version>${powermock.version}</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.opendaylight.infrautils</groupId>
+ <artifactId>counters-api</artifactId>
+ <version>${infrautils.version}</version>
+ </dependency>
</dependencies>
<!--
--- /dev/null
+/*
+ * Copyright (c) 2016 Hewlett-Packard Enterprise 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.netvirt.natservice.internal;
+
+import org.opendaylight.infrautils.counters.api.OccurenceCounter;
+
+public enum NatServiceCounters {
+ install_default_nat_flow, //
+ remove_default_nat_flow;
+
+ private OccurenceCounter counter;
+
+ private NatServiceCounters() {
+ counter = new OccurenceCounter(getClass().getEnclosingClass().getSimpleName(), name(), name());
+ }
+
+ public void inc() {
+ counter.inc();
+ }
+}
LOG.error("Flow entity received is NULL. Cannot proceed with installation of Default NAT flow");
return;
}
+ NatServiceCounters.install_default_nat_flow.inc();
mdsalManager.installFlow(flowEntity);
}
LOG.error("Flow entity received is NULL. Cannot proceed with installation of Default NAT flow");
return;
}
+ NatServiceCounters.install_default_nat_flow.inc();
mdsalManager.installFlow(flowEntity);
}
LOG.error("Flow entity received is NULL. Cannot proceed with installation of Default NAT flow");
return;
}
+ NatServiceCounters.remove_default_nat_flow.inc();
mdsalManager.removeFlow(flowEntity);
}
LOG.error("Flow entity received is NULL. Cannot proceed with installation of Default NAT flow");
return;
}
+ NatServiceCounters.remove_default_nat_flow.inc();
mdsalManager.removeFlow(flowEntity);
}
-
}