aboutsummaryrefslogtreecommitdiffstats
path: root/framework/src/onos/apps/pim
diff options
context:
space:
mode:
Diffstat (limited to 'framework/src/onos/apps/pim')
-rw-r--r--framework/src/onos/apps/pim/pom.xml122
-rw-r--r--framework/src/onos/apps/pim/src/main/java/org/onosproject/pim/cli/PIMShowCommand.java47
-rw-r--r--framework/src/onos/apps/pim/src/main/java/org/onosproject/pim/cli/package-info.java4
-rw-r--r--framework/src/onos/apps/pim/src/main/java/org/onosproject/pim/impl/PIMComponent.java82
-rw-r--r--framework/src/onos/apps/pim/src/main/java/org/onosproject/pim/impl/PIMInterface.java341
-rw-r--r--framework/src/onos/apps/pim/src/main/java/org/onosproject/pim/impl/PIMInterfaces.java260
-rw-r--r--framework/src/onos/apps/pim/src/main/java/org/onosproject/pim/impl/PIMInterfacesCodec.java96
-rw-r--r--framework/src/onos/apps/pim/src/main/java/org/onosproject/pim/impl/PIMNeighbor.java320
-rw-r--r--framework/src/onos/apps/pim/src/main/java/org/onosproject/pim/impl/PIMPacketHandler.java229
-rw-r--r--framework/src/onos/apps/pim/src/main/java/org/onosproject/pim/impl/PIMTimer.java72
-rw-r--r--framework/src/onos/apps/pim/src/main/java/org/onosproject/pim/impl/package-info.java20
-rw-r--r--framework/src/onos/apps/pim/src/main/resources/OSGI-INF.blueprint/shell-config.xml24
12 files changed, 0 insertions, 1617 deletions
diff --git a/framework/src/onos/apps/pim/pom.xml b/framework/src/onos/apps/pim/pom.xml
deleted file mode 100644
index 6d3785e9..00000000
--- a/framework/src/onos/apps/pim/pom.xml
+++ /dev/null
@@ -1,122 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Copyright 2015 Open Networking Laboratory
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-<project xmlns="http://maven.apache.org/POM/4.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.onosproject</groupId>
- <artifactId>onos-apps</artifactId>
- <version>1.4.0-rc1</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
-
- <artifactId>onos-app-pim</artifactId>
- <packaging>bundle</packaging>
-
- <description>Protocol Independent Multicast Emulation</description>
-
- <properties>
- <onos.app.name>org.onosproject.pim</onos.app.name>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>org.onosproject</groupId>
- <artifactId>onos-api</artifactId>
- <version>${project.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.onosproject</groupId>
- <artifactId>onos-cli</artifactId>
- <version>${project.version}</version>
- </dependency>
-
-
- <dependency>
- <groupId>org.onosproject</groupId>
- <artifactId>onlab-osgi</artifactId>
- <version>${project.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.onosproject</groupId>
- <artifactId>onlab-junit</artifactId>
- <scope>test</scope>
- </dependency>
-
- <!-- This is needed by ComponentContext, used for tunable configuration -->
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>org.osgi.compendium</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.apache.karaf.shell</groupId>
- <artifactId>org.apache.karaf.shell.console</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.scr.annotations</artifactId>
- <version>1.9.8</version>
- <scope>provided</scope>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <extensions>true</extensions>
- <configuration>
- <instructions>
- <Bundle-SymbolicName>
- ${project.groupId}.${project.artifactId}
- </Bundle-SymbolicName>
- <Import-Package>
- org.slf4j,
- org.osgi.framework,
- org.apache.commons.lang.math.*,
- com.google.common.*,
- org.apache.karaf.shell.commands,
- org.apache.karaf.shell.console,
- org.onlab.packet.*,
- org.onlab.rest.*,
- org.onosproject.*,
- org.onosproject.mfwd.impl.*;
- org.onlab.util.*,
- org.jboss.netty.util.*
- </Import-Package>
- </instructions>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>2.5.1</version>
- <configuration>
- <source>1.8</source>
- <target>1.8</target>
- </configuration>
- </plugin>
- </plugins>
- </build>
-</project>
diff --git a/framework/src/onos/apps/pim/src/main/java/org/onosproject/pim/cli/PIMShowCommand.java b/framework/src/onos/apps/pim/src/main/java/org/onosproject/pim/cli/PIMShowCommand.java
deleted file mode 100644
index 6bd563b6..00000000
--- a/framework/src/onos/apps/pim/src/main/java/org/onosproject/pim/cli/PIMShowCommand.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright 2014-2015 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.pim.cli;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import org.apache.karaf.shell.commands.Command;
-import org.onosproject.cli.AbstractShellCommand;
-import org.onosproject.pim.impl.PIMInterface;
-import org.onosproject.pim.impl.PIMInterfaces;
-import org.onosproject.pim.impl.PIMInterfacesCodec;
-
-import java.util.Collection;
-
-@Command(scope = "onos", name = "pim-interfaces", description = "Displays the pim interfaces")
-public class PIMShowCommand extends AbstractShellCommand {
-
- // prints either the json or cli version of the hash map connect point
- // neighbors from the PIMInterfaces class.
- @Override
- protected void execute() {
- // grab connect point neighbors hash map to send in to json encoder.
- Collection<PIMInterface> pimIntfs = PIMInterfaces.getInstance().getInterfaces();
- if (outputJson()) {
- print("%s", json(pimIntfs));
- } else {
- print(PIMInterfaces.getInstance().printInterfaces());
- }
- }
-
- private JsonNode json(Collection<PIMInterface> pimIntfs) {
- return new PIMInterfacesCodec().encode(pimIntfs, this);
- }
-
-} \ No newline at end of file
diff --git a/framework/src/onos/apps/pim/src/main/java/org/onosproject/pim/cli/package-info.java b/framework/src/onos/apps/pim/src/main/java/org/onosproject/pim/cli/package-info.java
deleted file mode 100644
index 954dacbb..00000000
--- a/framework/src/onos/apps/pim/src/main/java/org/onosproject/pim/cli/package-info.java
+++ /dev/null
@@ -1,4 +0,0 @@
-/**
- * PIM Multicast forwarding framework using intents.
- */
-package org.onosproject.pim.cli; \ No newline at end of file
diff --git a/framework/src/onos/apps/pim/src/main/java/org/onosproject/pim/impl/PIMComponent.java b/framework/src/onos/apps/pim/src/main/java/org/onosproject/pim/impl/PIMComponent.java
deleted file mode 100644
index 1a2d6f54..00000000
--- a/framework/src/onos/apps/pim/src/main/java/org/onosproject/pim/impl/PIMComponent.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.pim.impl;
-
-import static org.slf4j.LoggerFactory.getLogger;
-
-import org.apache.felix.scr.annotations.Activate;
-import org.apache.felix.scr.annotations.Component;
-import org.apache.felix.scr.annotations.Deactivate;
-import org.apache.felix.scr.annotations.Reference;
-import org.apache.felix.scr.annotations.ReferenceCardinality;
-import org.onosproject.core.ApplicationId;
-import org.onosproject.core.CoreService;
-import org.onosproject.incubator.net.intf.InterfaceService;
-import org.onosproject.net.config.NetworkConfigService;
-import org.onosproject.net.packet.PacketService;
-import org.slf4j.Logger;
-
-/**
- * Protocol Independent Multicast (PIM) Emulation. This component is responsible
- * for reference the services this PIM module is going to need, then initializing
- * the corresponding utility classes.
- */
-@Component(immediate = true)
-public class PIMComponent {
- private final Logger log = getLogger(getClass());
-
- // Register to receive PIM packets, used to send packets as well
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- protected PacketService packetService;
-
- // Get the appId
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- protected CoreService coreService;
-
- // Get the network configuration updates
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- protected NetworkConfigService configService;
-
- // Access defined network (IP) interfaces
- @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY)
- protected InterfaceService interfaceService;
-
- private static ApplicationId appId;
-
- private PIMInterfaces pimInterfaces;
- private PIMPacketHandler pimPacketHandler;
-
- @Activate
- public void activate() {
- appId = coreService.registerApplication("org.onosproject.pim");
-
- // Initialize the Packet Handler class
- pimPacketHandler = PIMPacketHandler.getInstance();
- pimPacketHandler.initialize(packetService, appId);
-
- // Initialize the Interface class
- pimInterfaces = PIMInterfaces.getInstance();
- pimInterfaces.initialize(configService, interfaceService);
-
- log.info("Started");
- }
-
- @Deactivate
- public void deactivate() {
- PIMPacketHandler.getInstance().stop();
- log.info("Stopped");
- }
-}
diff --git a/framework/src/onos/apps/pim/src/main/java/org/onosproject/pim/impl/PIMInterface.java b/framework/src/onos/apps/pim/src/main/java/org/onosproject/pim/impl/PIMInterface.java
deleted file mode 100644
index 5da5c2b3..00000000
--- a/framework/src/onos/apps/pim/src/main/java/org/onosproject/pim/impl/PIMInterface.java
+++ /dev/null
@@ -1,341 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.pim.impl;
-
-import org.onlab.packet.Ethernet;
-import org.onlab.packet.IPv4;
-import org.onlab.packet.Ip4Address;
-import org.onlab.packet.IpAddress;
-import org.onlab.packet.MacAddress;
-import org.onlab.packet.PIM;
-import org.onlab.packet.pim.PIMHello;
-import org.onlab.packet.pim.PIMHelloOption;
-import org.onosproject.incubator.net.intf.Interface;
-import org.onosproject.net.ConnectPoint;
-import org.onosproject.net.host.InterfaceIpAddress;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-/**
- * The PIM Interface is a wrapper around a ConnectPoint and used to provide
- * hello options values when "talking" with PIM other PIM routers.
- */
-public class PIMInterface {
- private static Logger log = LoggerFactory.getLogger("PIMInterfaces");
-
- // Interface from the interface subsystem
- private Interface theInterface;
-
- // The list of PIM neighbors adjacent to this interface
- private Map<IpAddress, PIMNeighbor> neighbors = new HashMap<>();
-
- // The designatedRouter for this LAN
- private PIMNeighbor designatedRouter;
-
- // The priority we use on this ConnectPoint.
- private int priority = PIMHelloOption.DEFAULT_PRIORITY;
-
- // The holdtime we are sending out.
- private int holdtime = PIMHelloOption.DEFAULT_HOLDTIME;
-
- // Then generation ID we are sending out. 0 means we need to generate a new random ID
- private int genid = PIMHelloOption.DEFAULT_GENID;
-
- // Our default prune delay
- private int prunedelay = PIMHelloOption.DEFAULT_PRUNEDELAY;
-
- /**
- * Create a PIMInterface.
- *
- * @param intf the network interface configuration
- */
- public PIMInterface(Interface intf) {
-
- log.debug("Adding an interface: " + intf.toString() + "\n");
- this.theInterface = intf;
-
- // Send a hello to let our neighbors know we are alive
- sendHello();
- }
-
- /**
- * Get the PIM Interface.
- *
- * @return the PIM Interface
- */
- public Interface getInterface() {
- return theInterface;
- }
-
- /**
- * Getter for our IP address.
- *
- * @return our IP address.
- */
- public IpAddress getIpAddress() {
- if (theInterface.ipAddresses().isEmpty()) {
- return null;
- }
-
- // We will just assume the first interface on the list
- IpAddress ipaddr = null;
- for (InterfaceIpAddress ifipaddr : theInterface.ipAddresses()) {
- ipaddr = ifipaddr.ipAddress();
- break;
- }
- return ipaddr;
- }
-
- /**
- * Get our priority.
- *
- * @return our priority.
- */
- public int getPriority() {
- return this.priority;
- }
-
- /**
- * Get the designated router on this connection.
- *
- * @return the PIMNeighbor representing the DR
- */
- public PIMNeighbor getDesignatedRouter() {
- return designatedRouter;
- }
-
- /**
- * Are we the DR on this CP?
- *
- * @return true if we are, false if not
- */
- public boolean areWeDr() {
- return (designatedRouter != null &&
- designatedRouter.getPrimaryAddr().equals(this.getIpAddress()));
- }
-
- /**
- * Return a collection of PIM Neighbors.
- *
- * @return the collection of PIM Neighbors
- */
- public Collection<PIMNeighbor> getNeighbors() {
- return this.neighbors.values();
- }
-
- /**
- * Find the neighbor with the given IP address on this CP.
- *
- * @param ipaddr the IP address of the neighbor we are interested in
- * @return the pim neighbor if it exists
- */
- public PIMNeighbor findNeighbor(IpAddress ipaddr) {
- PIMNeighbor nbr = neighbors.get(ipaddr);
- return nbr;
- }
-
- /**
- * Add a new PIM neighbor to this list.
- *
- * @param nbr the neighbor to be added.
- */
- public void addNeighbor(PIMNeighbor nbr) {
- if (neighbors.containsKey(nbr.getPrimaryAddr())) {
-
- log.debug("We are adding a neighbor that already exists: {}", nbr.toString());
- neighbors.remove(nbr.getPrimaryAddr());
- }
- neighbors.put(nbr.getPrimaryAddr(), nbr);
- }
-
- /**
- * Remove the neighbor from our neighbor list.
- *
- * @param ipaddr the IP address of the neighbor to remove
- */
- public void removeNeighbor(IpAddress ipaddr) {
-
- if (neighbors.containsKey(ipaddr)) {
- neighbors.remove(ipaddr);
- }
- this.electDR();
- }
-
- /**
- * Remove the given neighbor from the neighbor list.
- *
- * @param nbr the nbr to be removed.
- */
- public void removeNeighbor(PIMNeighbor nbr) {
-
- neighbors.remove(nbr.getPrimaryAddr(), nbr);
- this.electDR();
- }
-
- /**
- * Elect a new DR on this ConnectPoint.
- *
- * @return the PIM Neighbor that wins
- */
- public PIMNeighbor electDR() {
-
- for (PIMNeighbor nbr : this.neighbors.values()) {
- if (this.designatedRouter == null) {
- this.designatedRouter = nbr;
- continue;
- }
-
- if (nbr.getPriority() > this.designatedRouter.getPriority()) {
- this.designatedRouter = nbr;
- continue;
- }
-
- // We could sort in ascending order
- if (this.designatedRouter.getPrimaryAddr().compareTo(nbr.getPrimaryAddr()) > 0) {
- this.designatedRouter = nbr;
- continue;
- }
- }
-
- return this.designatedRouter;
- }
-
- /**
- * Elect a new DR given the new neighbor.
- *
- * @param nbr the new neighbor to use in DR election.
- * @return the PIM Neighbor that wins DR election
- */
- public PIMNeighbor electDR(PIMNeighbor nbr) {
-
- // Make sure I have
- if (this.designatedRouter == null ||
- this.designatedRouter.getPriority() < nbr.getPriority() ||
- this.designatedRouter.getPrimaryAddr().compareTo(nbr.getPrimaryAddr()) > 0) {
- this.designatedRouter = nbr;
- }
- return this.designatedRouter;
- }
-
- /**
- * Find or create a pim neighbor with a given ip address and connect point.
- *
- * @param ipaddr of the pim neighbor
- * @param mac The mac address of our sending neighbor
- * @return an existing or new PIM neighbor
- */
- public PIMNeighbor findOrCreate(IpAddress ipaddr, MacAddress mac) {
- PIMNeighbor nbr = this.findNeighbor(ipaddr);
- if (nbr == null) {
- nbr = new PIMNeighbor(ipaddr, mac, this);
- this.addNeighbor(nbr);
- this.electDR(nbr);
- }
- return nbr;
- }
-
- /**
- * Process a hello packet received on this Interface.
- *
- * @param ethPkt the ethernet packet containing the hello message
- * @param cp the ConnectPoint of this interface
- */
- public void processHello(Ethernet ethPkt, ConnectPoint cp) {
- checkNotNull(ethPkt);
- checkNotNull(cp);
-
- MacAddress srcmac = ethPkt.getSourceMAC();
- IPv4 ip = (IPv4) ethPkt.getPayload();
- Ip4Address srcip = Ip4Address.valueOf(ip.getSourceAddress());
-
- PIM pim = (PIM) ip.getPayload();
- checkNotNull(pim);
-
- PIMHello hello = (PIMHello) pim.getPayload();
- checkNotNull(hello);
-
- PIMNeighbor nbr = this.findOrCreate(srcip, srcmac);
- if (nbr == null) {
- log.error("Could not create a neighbor for: {1}", srcip.toString());
- return;
- }
-
- ConnectPoint icp = theInterface.connectPoint();
- checkNotNull(icp);
- if (!cp.equals(icp)) {
- log.error("PIM Hello message received from {} on incorrect interface {}",
- nbr.getPrimaryAddr(), this.toString());
- return;
- }
- nbr.refresh(hello);
- }
-
- /**
- * Send a hello packet from this interface.
- */
- public void sendHello() {
- PIM pim = new PIM();
- PIMHello hello = new PIMHello();
-
- // Create a PIM Hello
- pim = new PIM();
- pim.setVersion((byte) 2);
- pim.setPIMType((byte) PIM.TYPE_HELLO);
- pim.setChecksum((short) 0);
-
- hello = new PIMHello();
- hello.createDefaultOptions();
- pim.setPayload(hello);
- hello.setParent(pim);
-
- log.debug("Sending hello: \n");
- PIMPacketHandler.getInstance().sendPacket(pim, this);
- }
-
- /**
- * prints the connectPointNeighbors list with each neighbor list.
- *
- * @return string of neighbors.
- */
- public String printNeighbors() {
- String out = "PIM Neighbors Table: \n";
- for (PIMNeighbor nbr : this.neighbors.values()) {
- out += "\t" + nbr.toString();
- }
- return out;
- }
-
- @Override
- public String toString() {
- IpAddress ipaddr = this.getIpAddress();
- String out = "PIM Neighbors: ";
- if (ipaddr != null) {
- out += "IP: " + ipaddr.toString();
- } else {
- out += "IP: *Null*";
- }
- out += "\tPR: " + String.valueOf(this.priority) + "\n";
- return out;
- }
-
-}
-
diff --git a/framework/src/onos/apps/pim/src/main/java/org/onosproject/pim/impl/PIMInterfaces.java b/framework/src/onos/apps/pim/src/main/java/org/onosproject/pim/impl/PIMInterfaces.java
deleted file mode 100644
index 70ade23a..00000000
--- a/framework/src/onos/apps/pim/src/main/java/org/onosproject/pim/impl/PIMInterfaces.java
+++ /dev/null
@@ -1,260 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.pim.impl;
-
-import org.jboss.netty.util.Timeout;
-import org.jboss.netty.util.TimerTask;
-import org.onosproject.incubator.net.config.basics.ConfigException;
-import org.onosproject.incubator.net.config.basics.InterfaceConfig;
-import org.onosproject.incubator.net.intf.Interface;
-import org.onosproject.incubator.net.intf.InterfaceService;
-import org.onosproject.net.ConnectPoint;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.TimeUnit;
-
-import org.onosproject.net.config.NetworkConfigEvent;
-import org.onosproject.net.config.NetworkConfigListener;
-import org.onosproject.net.config.NetworkConfigService;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * PIMInterfaces is a collection of all neighbors we have received
- * PIM hello messages from. The main structure is a HashMap indexed
- * by ConnectPoint with another HashMap indexed on the PIM neighbors
- * IPAddress, it contains all PIM neighbors attached on that ConnectPoint.
- */
-public final class PIMInterfaces {
-
- private Logger log = LoggerFactory.getLogger("PIMInterfaces");
-
- private static PIMInterfaces instance = null;
-
- // Used to listen to network configuration changes
- private NetworkConfigService configService;
-
- // Used to access IP Interface definitions for our segment
- private InterfaceService interfaceService;
-
- // Internal class used to listen for network configuration changes
- private InternalConfigListener configListener = new InternalConfigListener();
-
- // This is the global container for all PIM Interfaces indexed by ConnectPoints.
- private Map<ConnectPoint, PIMInterface> interfaces = new HashMap<>();
-
- // Default hello message interval
- private int helloMessageInterval = 60;
-
- // Timer used to send hello messages on this interface
- private Timeout helloTimer;
-
- // Required by a utility class
- private PIMInterfaces() {}
-
- /**
- * Get the instance of PIMInterfaces. Create the instance if needed.
- *
- * @return PIMInterface instance
- */
- public static PIMInterfaces getInstance() {
- if (null == instance) {
- instance = new PIMInterfaces();
- }
- return instance;
- }
-
- // Initialize the services
- public void initialize(NetworkConfigService cs, InterfaceService is) {
- configService = cs;
- interfaceService = is;
-
- // Initialize interfaces if they already exist
- initInterfaces();
-
- // Listen for network config changes
- configService.addListener(configListener);
- }
-
- /**
- * Listener for network config events.
- */
- private class InternalConfigListener implements NetworkConfigListener {
-
- private void updateInterfaces(InterfaceConfig config) {
- Set<Interface> intfs;
- try {
- intfs = config.getInterfaces();
- } catch (ConfigException e) {
- log.error(e.toString());
- return;
- }
- for (Interface intf : intfs) {
- addInterface(intf);
- }
- }
-
- /**
- * Remove the PIMInterface represented by the ConnectPoint. If the
- * PIMInterface does not exist this function is a no-op.
- *
- * @param cp The connectPoint representing the PIMInterface to be removed.
- */
- private void removeInterface(ConnectPoint cp) {
- PIMInterfaces.this.removeInterface(cp);
- }
-
- @Override
- public void event(NetworkConfigEvent event) {
- switch (event.type()) {
- case CONFIG_ADDED:
- case CONFIG_UPDATED:
- log.debug("Config updated: " + event.toString() + "\n");
- if (event.configClass() == InterfaceConfig.class) {
- InterfaceConfig config =
- configService.getConfig((ConnectPoint) event.subject(), InterfaceConfig.class);
- updateInterfaces(config);
- }
- break;
- case CONFIG_REMOVED:
- if (event.configClass() == InterfaceConfig.class) {
- removeInterface((ConnectPoint) event.subject());
- }
- break;
- case CONFIG_REGISTERED:
- case CONFIG_UNREGISTERED:
- default:
- break;
- }
- }
- }
-
- // Configure interfaces if they already exist.
- private void initInterfaces() {
- Set<Interface> intfs = interfaceService.getInterfaces();
- for (Interface intf : intfs) {
- log.debug("Adding interface: " + intf.toString() + "\n");
- addInterface(intf);
- }
- }
-
- /**
- * Create a PIM Interface and add to our interfaces list.
- *
- * @param intf the interface to add
- * @return the PIMInterface
- */
- public PIMInterface addInterface(Interface intf) {
- PIMInterface pif = new PIMInterface(intf);
- interfaces.put(intf.connectPoint(), pif);
-
- // If we have added our first interface start the hello timer.
- if (interfaces.size() == 1) {
- startHelloTimer();
- }
-
- // Return this interface
- return pif;
- }
-
- /**
- * Remove the PIMInterface from the given ConnectPoint.
- *
- * @param cp the ConnectPoint indexing the PIMInterface to be removed.
- */
- public void removeInterface(ConnectPoint cp) {
- if (interfaces.containsKey(cp)) {
- interfaces.remove(cp);
- }
-
- if (interfaces.size() == 0) {
- PIMTimer.stop();
- }
- }
-
- /**
- * Return a collection of PIMInterfaces for use by the PIM Interface codec.
- *
- * @return the collection of PIMInterfaces
- */
- public Collection<PIMInterface> getInterfaces() {
- return interfaces.values();
- }
-
- /**
- * Get the PIM Interface indexed by the given ConnectPoint.
- *
- * @param cp the connect point
- * @return the PIMInterface if it exists, NULL if not
- */
- public PIMInterface getInterface(ConnectPoint cp) {
- return interfaces.get(cp);
- }
-
- /**
- * Return a string of PIMInterfaces for the cli command.
- *
- * @return a string representing PIM interfaces
- */
- public String printInterfaces() {
- String str = "";
- for (PIMInterface pi : interfaces.values()) {
- str += pi.toString();
- }
- return str;
- }
-
- /* ---------------------------------- PIM Hello Timer ----------------------------------- */
-
- /**
- * Start a new hello timer for this interface.
- */
- private void startHelloTimer() {
- helloTimer = PIMTimer.getTimer().newTimeout(
- new HelloTimer(),
- helloMessageInterval,
- TimeUnit.SECONDS);
-
- log.debug("Started Hello Timer");
- }
-
- /**
- * This inner class handles transmitting a PIM hello message on this ConnectPoint.
- */
- private final class HelloTimer implements TimerTask {
-
- HelloTimer() {
- }
-
- @Override
- public void run(Timeout timeout) throws Exception {
-
- log.debug("Running Hello Timer\n");
- // Technically we should not send all hello's in synch..
- for (PIMInterface pi : interfaces.values()) {
- pi.sendHello();
- }
-
- // restart the hello timer
- if (interfaces.size() > 0) {
- startHelloTimer();
- }
- }
- }
-} \ No newline at end of file
diff --git a/framework/src/onos/apps/pim/src/main/java/org/onosproject/pim/impl/PIMInterfacesCodec.java b/framework/src/onos/apps/pim/src/main/java/org/onosproject/pim/impl/PIMInterfacesCodec.java
deleted file mode 100644
index ddd7a597..00000000
--- a/framework/src/onos/apps/pim/src/main/java/org/onosproject/pim/impl/PIMInterfacesCodec.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.pim.impl;
-
-import com.fasterxml.jackson.databind.node.ArrayNode;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-import org.onosproject.codec.CodecContext;
-import org.onosproject.codec.JsonCodec;
-
-import java.util.Collection;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-/**
- * PIM neighbors Codec.
- */
-public class PIMInterfacesCodec extends JsonCodec<Collection<PIMInterface>> {
- // JSON field names
- //Return Name
- private static final String CPNBRLIST = "connect_point_list";
-
- // PIM Neightbors Fields
- private static final String IP = "ip";
- private static final String PRIORITY = "priority";
- private static final String NBRLIST = "neighbor_list";
-
- // PIM neighbor Files
- private static final String DR = "designated";
- private static final String NBR_IP = "ip";
- private static final String PR = "priority";
- private static final String HOLDTIME = "hold_time";
-
- /**
- * Encode the PIM Neighbors.
- *
- * @param cpn ConnectPoint neighbors
- * @param context encoding context
- *
- * @return Encoded neighbors used by CLI and REST
- */
- @Override
- public ObjectNode encode(Collection<PIMInterface> cpn, CodecContext context) {
- checkNotNull(cpn, "Pim Neighbors cannot be null");
-
- ObjectNode pimNbrJsonCodec = context.mapper().createObjectNode();
- ArrayNode cpnList = context.mapper().createArrayNode();
-
- for (PIMInterface pn: cpn) {
- // get the PimNeighbors Obj, contains Neighbors list
- // create the json object for a single Entry in the Neighbors list
- ObjectNode cp = context.mapper().createObjectNode();
- cp.put(IP, pn.getIpAddress().toString());
- cp.put(PRIORITY, String.valueOf(pn.getPriority()));
-
- // create the array for the neighbors list
- ArrayNode nbrsList = context.mapper().createArrayNode();
- for (PIMNeighbor nbr : pn.getNeighbors()) {
- nbrsList.add(neighbor(nbr, context));
- }
- // adds pim neighbor to list
- cp.set(NBRLIST, nbrsList);
- // adds to arraynode which will represent the connect point neighbors hash map.
- cpnList.add(cp);
- }
- pimNbrJsonCodec.set(CPNBRLIST, cpnList);
- return pimNbrJsonCodec;
- }
-
- /**
- * Encode a single PIM Neighbor.
- *
- * @param nbr the neighbor to be encoded
- * @param context encoding context
- * @return the encoded neighbor
- */
- private ObjectNode neighbor(PIMNeighbor nbr, CodecContext context) {
- return context.mapper().createObjectNode()
- .put(DR, Boolean.toString(nbr.isDr()))
- .put(NBR_IP, nbr.getPrimaryAddr().toString())
- .put(PR, String.valueOf(nbr.getPriority()))
- .put(HOLDTIME, String.valueOf(nbr.getHoldtime()));
- }
-}
diff --git a/framework/src/onos/apps/pim/src/main/java/org/onosproject/pim/impl/PIMNeighbor.java b/framework/src/onos/apps/pim/src/main/java/org/onosproject/pim/impl/PIMNeighbor.java
deleted file mode 100644
index 73d1598a..00000000
--- a/framework/src/onos/apps/pim/src/main/java/org/onosproject/pim/impl/PIMNeighbor.java
+++ /dev/null
@@ -1,320 +0,0 @@
-/*
- * Copyright 2014-2015 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in reliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.pim.impl;
-
-import org.jboss.netty.util.Timeout;
-import org.jboss.netty.util.TimerTask;
-import org.onlab.packet.IpAddress;
-import org.onlab.packet.MacAddress;
-import org.onlab.packet.pim.PIMHello;
-import org.onlab.packet.pim.PIMHelloOption;
-import org.onosproject.net.ConnectPoint;
-import org.slf4j.Logger;
-
-import java.nio.ByteBuffer;
-import java.util.concurrent.TimeUnit;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static org.slf4j.LoggerFactory.getLogger;
-
-/**
- * PIMNeighbor represents all the PIM routers that have sent us
- * hello messages, or that possibly have been statically configured.
- */
-public class PIMNeighbor {
- private final Logger log = getLogger(getClass());
-
- // The primary address of this PIM neighbor
- private IpAddress primaryAddr;
-
- // The MacAddress of this neighbor
- private MacAddress macAddress;
-
- // The ConnectPoint this PIM neighbor is connected to.
- private ConnectPoint connectPoint;
-
- // Is this neighbor us?
- private boolean isThisUs = false;
-
- // The option values this neighbor has sent us.
- private int priority = 0;
- private int genId = 0;
- private short holdtime = 0;
-
- // Is this pim neighbor the DR?
- private boolean isDr = false;
-
- // Timeout for this neighbor
- private volatile Timeout timeout;
-
- // A back pointer the neighbors list this neighbor belongs to.
- private PIMInterface pimInterface;
-
- /**
- * Construct this neighbor from the address and connect point.
- *
- * @param ipaddr IP Address of neighbor
- * @param macaddr MAC Address of the neighbor
- * @param pimInterface The PIMInterface of this neighbor
- */
- public PIMNeighbor(IpAddress ipaddr, MacAddress macaddr, PIMInterface pimInterface) {
- this.macAddress = macaddr;
- this.primaryAddr = ipaddr;
- this.pimInterface = pimInterface;
- this.resetTimeout();
- }
-
- /**
- * Get the primary address of this neighbor.
- *
- * @return the primary IP address.
- */
- public IpAddress getPrimaryAddr() {
- return primaryAddr;
- }
-
- /**
- * Set the primary address of this neighbor.
- *
- * @param primaryAddr the address we'll use when sending hello messages
- */
- public void setPrimaryAddr(IpAddress primaryAddr) {
- this.primaryAddr = primaryAddr;
- }
-
- /**
- * Get the priority this neighbor has advertised to us.
- *
- * @return the priority
- */
- public int getPriority() {
- return priority;
- }
-
- /**
- * Set the priority for this neighbor.
- *
- * @param priority This neighbors priority.
- */
- public void setPriority(int priority) {
- this.priority = priority;
- }
-
- /**
- * Get the generation ID.
- *
- * @return the generation ID.
- */
- public int getGenId() {
- return genId;
- }
-
- /**
- * Set the generation ID.
- *
- * @param genId the generation ID.
- */
- public void setGenId(int genId) {
- this.genId = genId;
- }
-
- /**
- * Get the holdtime for this neighbor.
- *
- * @return the holdtime
- */
- public short getHoldtime() {
- return holdtime;
- }
-
- /**
- * Set the holdtime for this neighbor.
- *
- * @param holdtime the holdtime.
- */
- public void setholdtime(short holdtime) {
- this.holdtime = holdtime;
- }
-
- /**
- * Is this neighbor the designated router on this connect point?
- *
- * @return true if so, false if not.
- */
- public boolean isDr() {
- return isDr;
- }
-
- /**
- * Set this router as the designated router on this connect point.
- *
- * @param isDr True is this neighbor is the DR false otherwise
- */
- public void setIsDr(boolean isDr) {
- this.isDr = isDr;
- }
-
- /**
- * The ConnectPoint this neighbor is connected to.
- *
- * @return the ConnectPoint
- */
- public PIMInterface getPimInterface() {
- return pimInterface;
- }
-
- /**
- * We have received a fresh hello from this neighbor, now we need to process it.
- * Depending on the values received in the the hello options may force a
- * re-election process.
- *
- * We will also refresh the timeout for this neighbor.
- *
- * @param hello copy of the hello we'll be able to extract options from.
- */
- public void refresh(PIMHello hello) {
- checkNotNull(hello);
-
- boolean reelect = false;
- for (PIMHelloOption opt : hello.getOptions().values()) {
-
- int len = opt.getOptLength();
- ByteBuffer bb = ByteBuffer.wrap(opt.getValue());
-
- switch (opt.getOptType()) {
- case PIMHelloOption.OPT_GENID:
- int newid = bb.getInt();
- if (this.genId != newid) {
-
- // We have a newly rebooted neighbor, this is where we would
- // send them our joins.
- this.genId = newid;
- }
- break;
-
- case PIMHelloOption.OPT_PRIORITY:
- int newpri = bb.getInt();
- if (this.priority != newpri) {
-
- // The priorities have changed. We may need to re-elect a new DR?
- if (this.isDr || pimInterface.getDesignatedRouter().getPriority() < priority) {
- reelect = true;
- }
- this.priority = newpri;
- }
- break;
-
- case PIMHelloOption.OPT_HOLDTIME:
- short holdtime = bb.getShort();
- if (this.holdtime != holdtime) {
- this.holdtime = holdtime;
- if (holdtime == 0) {
- // We have a neighbor going down. We can remove all joins
- // we have learned from them.
-
- log.debug("PIM Neighbor has timed out: {}", this.primaryAddr.toString());
- return;
- }
- }
- break;
-
- case PIMHelloOption.OPT_PRUNEDELAY:
- case PIMHelloOption.OPT_ADDRLIST:
- // TODO: implement prune delay and addr list. Fall through for now.
-
- default:
- log.debug("PIM Hello option type: {} not yet supported or unknown.", opt.getOptType());
- break;
- }
- }
-
- if (reelect) {
- pimInterface.electDR(this);
- }
-
- // Reset the next timeout timer
- this.resetTimeout();
- }
-
- /* --------------------------------------- Timer functions -------------------------- */
-
- /**
- * Restart the timeout task for this neighbor.
- */
- private void resetTimeout() {
-
- if (this.holdtime == 0) {
-
- // Prepare to die.
- log.debug("shutting down timer for nbr {}", this.primaryAddr.toString());
- if (this.timeout != null) {
- this.timeout.cancel();
- this.timeout = null;
- }
- return;
- }
-
- // Cancel the existing timeout and start a fresh new one.
- if (this.timeout != null) {
- this.timeout.cancel();
- }
-
- this.timeout = PIMTimer.getTimer().newTimeout(new NeighborTimeoutTask(this), holdtime, TimeUnit.SECONDS);
- }
-
- /**
- * The task to run when a neighbor timeout expires.
- */
- private final class NeighborTimeoutTask implements TimerTask {
- PIMNeighbor nbr;
-
- NeighborTimeoutTask(PIMNeighbor nbr) {
- this.nbr = nbr;
- }
-
- @Override
- public void run(Timeout timeout) throws Exception {
-
- log.debug("PIM Neighbor {} has timed out: ", nbr.toString());
- nbr.pimInterface.removeNeighbor(nbr);
- }
- }
-
- /**
- * Stop the timeout timer.
- *
- * This happens when we remove the neighbor.
- */
- private final void stopTimeout() {
- this.timeout.cancel();
- this.timeout = null;
- }
-
- @Override
- public String toString() {
- String out = "";
- if (this.isDr) {
- out += "*NBR:";
- } else {
- out += "NBR:";
- }
- out += "\tIP: " + this.primaryAddr.toString();
- out += "\tPr: " + String.valueOf(this.priority);
- out += "\tHoldTime: " + String.valueOf(this.holdtime);
- out += "\tGenID: " + String.valueOf(this.genId) + "\n";
- return out;
- }
-} \ No newline at end of file
diff --git a/framework/src/onos/apps/pim/src/main/java/org/onosproject/pim/impl/PIMPacketHandler.java b/framework/src/onos/apps/pim/src/main/java/org/onosproject/pim/impl/PIMPacketHandler.java
deleted file mode 100644
index c1ad2cfe..00000000
--- a/framework/src/onos/apps/pim/src/main/java/org/onosproject/pim/impl/PIMPacketHandler.java
+++ /dev/null
@@ -1,229 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.pim.impl;
-
-import org.onlab.packet.Ethernet;
-import org.onlab.packet.IPv4;
-import org.onlab.packet.Ip4Address;
-import org.onlab.packet.IpAddress;
-import org.onlab.packet.IpPrefix;
-import org.onlab.packet.MacAddress;
-import org.onlab.packet.PIM;
-import org.onlab.packet.VlanId;
-import org.onosproject.core.ApplicationId;
-import org.onosproject.incubator.net.intf.Interface;
-import org.onosproject.net.ConnectPoint;
-import org.onosproject.net.flow.DefaultTrafficSelector;
-import org.onosproject.net.flow.DefaultTrafficTreatment;
-import org.onosproject.net.flow.TrafficSelector;
-import org.onosproject.net.flow.TrafficTreatment;
-import org.onosproject.net.packet.DefaultOutboundPacket;
-import org.onosproject.net.packet.InboundPacket;
-import org.onosproject.net.packet.OutboundPacket;
-import org.onosproject.net.packet.PacketContext;
-import org.onosproject.net.packet.PacketPriority;
-import org.onosproject.net.packet.PacketProcessor;
-import org.onosproject.net.packet.PacketService;
-import org.slf4j.Logger;
-
-import java.nio.ByteBuffer;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-import static org.slf4j.LoggerFactory.getLogger;
-
-/**
- * Handing Incoming and outgoing PIM packets.
- */
-public final class PIMPacketHandler {
- private final Logger log = getLogger(getClass());
-
- private static PIMPacketHandler instance = null;
-
- private PacketService packetService;
- private PIMPacketProcessor processor = new PIMPacketProcessor();
- private MacAddress pimDestinationMac = MacAddress.valueOf("01:00:5E:00:00:0d");
-
- // Utility class
- private PIMPacketHandler() {}
-
- public static PIMPacketHandler getInstance() {
- if (null == instance) {
- instance = new PIMPacketHandler();
- }
- return instance;
- }
-
- /**
- * Initialize the packet handling service.
- *
- * @param ps the packetService
- * @param appId our application ID
- */
- public void initialize(PacketService ps, ApplicationId appId) {
- packetService = ps;
-
- // Build a traffic selector for all multicast traffic
- TrafficSelector.Builder selector = DefaultTrafficSelector.builder();
- selector.matchEthType(Ethernet.TYPE_IPV4);
- selector.matchIPProtocol(IPv4.PROTOCOL_PIM);
- packetService.requestPackets(selector.build(), PacketPriority.REACTIVE, appId);
-
- packetService.addProcessor(processor, PacketProcessor.director(1));
- }
-
- /**
- * Shutdown the packet handling service.
- */
- public void stop() {
- packetService.removeProcessor(processor);
- processor = null;
- }
-
- /**
- * Packet processor responsible for handling IGMP packets.
- */
- public class PIMPacketProcessor implements PacketProcessor {
- private final Logger log = getLogger(getClass());
-
- @Override
- public void process(PacketContext context) {
- // Stop processing if the packet has been handled, since we
- // can't do any more to it.
- if (context.isHandled()) {
- return;
- }
-
- InboundPacket pkt = context.inPacket();
- if (pkt == null) {
- return;
- }
-
- Ethernet ethPkt = pkt.parsed();
- if (ethPkt == null) {
- return;
- }
-
- /*
- * IPv6 MLD packets are handled by ICMP6. We'll only deal
- * with IPv4.
- */
- if (ethPkt.getEtherType() != Ethernet.TYPE_IPV4) {
- return;
- }
-
- IPv4 ip = (IPv4) ethPkt.getPayload();
- IpAddress gaddr = IpAddress.valueOf(ip.getDestinationAddress());
- IpAddress saddr = Ip4Address.valueOf(ip.getSourceAddress());
- log.debug("Packet (" + saddr.toString() + ", " + gaddr.toString() +
- "\tingress port: " + context.inPacket().receivedFrom().toString());
-
- if (ip.getProtocol() != IPv4.PROTOCOL_PIM) {
- log.debug("PIM Picked up a non PIM packet: IP protocol: " + ip.getProtocol());
- return;
- }
-
- // TODO: check incoming to be PIM.PIM_ADDRESS or "Our" address.
- IpPrefix spfx = IpPrefix.valueOf(saddr, 32);
- IpPrefix gpfx = IpPrefix.valueOf(gaddr, 32);
-
- PIM pim = (PIM) ip.getPayload();
- switch (pim.getPimMsgType()) {
-
- case PIM.TYPE_HELLO:
- processHello(ethPkt, context.inPacket().receivedFrom());
- break;
-
- case PIM.TYPE_JOIN_PRUNE_REQUEST:
- // Create the function
- break;
-
- case PIM.TYPE_ASSERT:
- case PIM.TYPE_BOOTSTRAP:
- case PIM.TYPE_CANDIDATE_RP_ADV:
- case PIM.TYPE_GRAFT:
- case PIM.TYPE_GRAFT_ACK:
- case PIM.TYPE_REGISTER:
- case PIM.TYPE_REGISTER_STOP:
- log.debug("Unsupported PIM message type: " + pim.getPimMsgType());
- break;
-
- default:
- log.debug("Unkown PIM message type: " + pim.getPimMsgType());
- break;
- }
- }
-
- /**
- * Process incoming hello message, we will need the Macaddress and IP address of the sender.
- *
- * @param ethPkt the ethernet header
- * @param receivedFrom the connect point we recieved this message from
- */
- private void processHello(Ethernet ethPkt, ConnectPoint receivedFrom) {
- checkNotNull(ethPkt);
- checkNotNull(receivedFrom);
-
- // It is a problem if we don't have the
- PIMInterfaces pintfs = PIMInterfaces.getInstance();
- PIMInterface intf = pintfs.getInterface(receivedFrom);
- if (intf == null) {
- log.error("We received a PIM message on an interface we were not supposed to");
- return;
- }
- intf.processHello(ethPkt, receivedFrom);
- }
- }
-
- // Create an ethernet header and serialize then send
- public void sendPacket(PIM pim, PIMInterface pimIntf) {
-
- Interface theInterface = pimIntf.getInterface();
-
- // Create the ethernet packet
- Ethernet eth = new Ethernet();
- eth.setDestinationMACAddress(pimDestinationMac);
- eth.setSourceMACAddress(theInterface.mac());
- eth.setEtherType(Ethernet.TYPE_IPV4);
- if (theInterface.vlan() != VlanId.NONE) {
- eth.setVlanID(theInterface.vlan().toShort());
- }
-
- // Create the IP Packet
- IPv4 ip = new IPv4();
- ip.setVersion((byte) 4);
- ip.setTtl((byte) 20);
- ip.setProtocol(IPv4.PROTOCOL_PIM);
- ip.setChecksum((short) 0);
- ip.setSourceAddress(checkNotNull(pimIntf.getIpAddress()).getIp4Address().toInt());
- ip.setDestinationAddress(PIM.PIM_ADDRESS.getIp4Address().toInt());
- eth.setPayload(ip);
- ip.setParent(eth);
-
- // Now set pim
- ip.setPayload(pim);
- pim.setParent(ip);
-
- ConnectPoint cp = theInterface.connectPoint();
- checkNotNull(cp);
-
- TrafficTreatment treat = DefaultTrafficTreatment.builder().setOutput(cp.port()).build();
- ByteBuffer bb = ByteBuffer.wrap(eth.serialize());
- OutboundPacket packet = new DefaultOutboundPacket(cp.deviceId(), treat, bb);
- checkNotNull(packet);
-
- packetService.emit(packet);
- }
-}
diff --git a/framework/src/onos/apps/pim/src/main/java/org/onosproject/pim/impl/PIMTimer.java b/framework/src/onos/apps/pim/src/main/java/org/onosproject/pim/impl/PIMTimer.java
deleted file mode 100644
index c2a33033..00000000
--- a/framework/src/onos/apps/pim/src/main/java/org/onosproject/pim/impl/PIMTimer.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onosproject.pim.impl;
-
-import org.jboss.netty.util.HashedWheelTimer;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-/**
- * PIM Timer used for PIM Neighbors.
- */
-public final class PIMTimer {
-
- private static volatile HashedWheelTimer timer;
-
- // Ban public construction
- private PIMTimer() {
- }
-
- /**
- * Returns the singleton hashed-wheel timer.
- *
- * @return hashed-wheel timer
- */
- public static HashedWheelTimer getTimer() {
- if (PIMTimer.timer == null) {
- initTimer();
- }
- return PIMTimer.timer;
- }
-
- // Start the PIM timer.
- private static synchronized void initTimer() {
- if (PIMTimer.timer == null) {
-
- // Create and start a new hashed wheel timer, if it does not exist.
- HashedWheelTimer hwTimer = new HashedWheelTimer();
- hwTimer.start();
- PIMTimer.timer = hwTimer;
- }
- }
-
- public static void start() {
- if (PIMTimer.timer == null) {
- getTimer();
- }
- checkNotNull(timer);
- timer.start();
- }
-
- public static void stop() {
- if (PIMTimer.timer == null) {
- // No need to stop
- return;
- }
- checkNotNull(timer);
- timer.stop();
- }
-}
diff --git a/framework/src/onos/apps/pim/src/main/java/org/onosproject/pim/impl/package-info.java b/framework/src/onos/apps/pim/src/main/java/org/onosproject/pim/impl/package-info.java
deleted file mode 100644
index 29d1ce4e..00000000
--- a/framework/src/onos/apps/pim/src/main/java/org/onosproject/pim/impl/package-info.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright 2015 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * PIM Emulation speak hello messages and listen to Join/Prunes.
- */
-package org.onosproject.pim.impl;
diff --git a/framework/src/onos/apps/pim/src/main/resources/OSGI-INF.blueprint/shell-config.xml b/framework/src/onos/apps/pim/src/main/resources/OSGI-INF.blueprint/shell-config.xml
deleted file mode 100644
index c30e3792..00000000
--- a/framework/src/onos/apps/pim/src/main/resources/OSGI-INF.blueprint/shell-config.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<!--
- ~ Copyright 2015 Open Networking Laboratory
- ~
- ~ Licensed under the Apache License, Version 2.0 (the "License");
- ~ you may not use this file except in compliance with the License.
- ~ You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0">
-
- <command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.1.0">
- <command>
- <action class="org.onosproject.pim.cli.PIMShowCommand"/>
- </command>
- </command-bundle>
-
-</blueprint>