LOG.debug("re-started periodic RA Timer for routerIntf {}, int {}s", port.getIntfUUID(),
Ipv6Constants.PERIODIC_RA_INTERVAL);
}
+
+ public List<VirtualPort> getInterfaceCache() {
+ List<VirtualPort> virtualPorts = new ArrayList<>();
+ for (VirtualPort vport: vintfs.values()) {
+ virtualPorts.add(vport);
+ }
+ return virtualPorts;
+ }
+
+ public List<VirtualNetwork> getNetworkCache() {
+ List<VirtualNetwork> virtualNetworks = new ArrayList<>();
+ for (VirtualNetwork vnet: vnetworks.values()) {
+ virtualNetworks.add(vnet);
+ }
+ return virtualNetworks;
+ }
+
+ public List<VirtualSubnet> getSubnetCache() {
+ List<VirtualSubnet> virtualSubnets = new ArrayList<>();
+ for (VirtualSubnet vsubnet: vsubnets.values()) {
+ virtualSubnets.add(vsubnet);
+ }
+ return virtualSubnets;
+ }
+
+ public List<VirtualRouter> getRouterCache() {
+ List<VirtualRouter> virtualRouter = new ArrayList<>();
+ for (VirtualRouter vrouter: vrouters.values()) {
+ virtualRouter.add(vrouter);
+ }
+ return virtualRouter;
+ }
}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- vi: set et smarttab sw=4 tabstop=4: --><!--
+Copyright (c) 2017 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
+-->
+<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">
+
+ <parent>
+ <groupId>org.opendaylight.netvirt</groupId>
+ <artifactId>binding-parent</artifactId>
+ <version>0.6.0-SNAPSHOT</version>
+ <relativePath>../../commons/binding-parent</relativePath>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>ipv6service-shell</artifactId>
+ <name>ODL :: netvirt :: ${project.artifactId}</name>
+ <packaging>bundle</packaging>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.karaf.shell</groupId>
+ <artifactId>org.apache.karaf.shell.console</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.netvirt</groupId>
+ <artifactId>ipv6service-impl</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <!-- This bundle works with Karaf 3 and 4.0 -->
+ <Import-Package>
+ org.apache.karaf.shell.commands;version="[3.0.0,4.1)",
+ org.apache.karaf.shell.console;version="[3.0.0,4.1)",
+ *
+ </Import-Package>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <!--
+ Maven Site Configuration
+
+ The following configuration is necessary for maven-site-plugin to
+ correctly identify the correct deployment path for OpenDaylight Maven
+ sites.
+ -->
+ <url>${odl.site.url}/${project.groupId}/${stream}/${project.artifactId}/</url>
+
+ <distributionManagement>
+ <site>
+ <id>opendaylight-site</id>
+ <url>${nexus.site.url}/${project.artifactId}/</url>
+ </site>
+ </distributionManagement>
+</project>
--- /dev/null
+/*
+ * Copyright (c) 2017 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.netvirt.ipv6service.shell;
+
+import java.util.List;
+import org.apache.karaf.shell.commands.Argument;
+import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.console.OsgiCommandSupport;
+import org.opendaylight.infrautils.utils.TablePrinter;
+import org.opendaylight.netvirt.ipv6service.IfMgr;
+import org.opendaylight.netvirt.ipv6service.VirtualNetwork;
+import org.opendaylight.netvirt.ipv6service.VirtualPort;
+import org.opendaylight.netvirt.ipv6service.VirtualRouter;
+import org.opendaylight.netvirt.ipv6service.VirtualSubnet;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address;
+
+@Command(scope = "ipv6service", name = "ipv6CacheShow", description = "Displays the IPv6Service Cache info")
+public class ShowIpv6Command extends OsgiCommandSupport {
+ private IfMgr ifMgr = null;
+
+
+ @Argument(name = "resource", description = "List the various resource specific cache, where resource "
+ + "could be <networks/subnets/routers>", required = false, multiValued = false)
+ private final String listResource = null;
+
+ private String getPortIpv6Addresses(VirtualPort vport) {
+ List<Ipv6Address> ipv6Addresses = vport.getIpv6Addresses();
+ StringBuffer str = new StringBuffer();
+ for (Ipv6Address ipaddr: ipv6Addresses) {
+ str.append(ipaddr.getValue());
+ str.append(" ");
+ }
+ return str.toString();
+ }
+
+ @Override
+ protected Object doExecute() throws Exception {
+ ifMgr = IfMgr.getIfMgrInstance();
+ TablePrinter tp = new TablePrinter();
+
+ if (listResource != null) {
+ if (listResource.equalsIgnoreCase("networks")
+ || (listResource.equalsIgnoreCase("net"))) {
+ tp.setTitle("Network Cache List");
+ tp.setColumnNames("Sno", "NetworkId", "dpnId");
+ int count = 1;
+ List<VirtualNetwork> vnetworks = ifMgr.getNetworkCache();
+ for (VirtualNetwork vnet: vnetworks) {
+ tp.addRow(count++, String.valueOf(vnet.getNetworkUuid().getValue()), vnet.getDpnsHostingNetwork());
+ }
+ session.getConsole().print(tp.toString());
+ } else if (listResource.equalsIgnoreCase("subnets")
+ || (listResource.equalsIgnoreCase("subnet"))) {
+ tp.setTitle("Subnet Cache List");
+ tp.setColumnNames("Sno", "SubnetId", "SubnetCIDR", "ipVersion");
+ int count = 1;
+ List<VirtualSubnet> vsubnets = ifMgr.getSubnetCache();
+ for (VirtualSubnet vsubnet : vsubnets) {
+ tp.addRow(count++, String.valueOf(vsubnet.getSubnetUUID().getValue()),
+ String.valueOf(vsubnet.getSubnetCidr().getValue()),
+ vsubnet.getIpVersion());
+ }
+ session.getConsole().print(tp.toString());
+ } else if (listResource.equalsIgnoreCase("routers")
+ || (listResource.equalsIgnoreCase("router"))) {
+ tp.setTitle("Router Cache List");
+ tp.setColumnNames("Sno", "RouterId");
+ List<VirtualRouter> vrouters = ifMgr.getRouterCache();
+ int count = 1;
+ for (VirtualRouter vrouter : vrouters) {
+ tp.addRow(count++, String.valueOf(vrouter.getRouterUUID().getValue()));
+ }
+ session.getConsole().print(tp.toString());
+ }
+ } else {
+ tp.setTitle("Interface Cache List");
+ tp.setColumnNames("Sno", "PortId", "Mac Address", "Owner", "dpnId", "FixedIPs");
+ List<VirtualPort> vports = ifMgr.getInterfaceCache();
+ int count = 1;
+ for (VirtualPort vport: vports) {
+ String str = vport.getDeviceOwner();
+ tp.addRow(count++, String.valueOf(vport.getIntfUUID().getValue()), vport.getMacAddress(),
+ (str.startsWith("network:")) ? str.substring(str.lastIndexOf(':') + 1) : "compute",
+ vport.getDpId(), getPortIpv6Addresses(vport));
+ }
+ session.getConsole().print(tp.toString());
+ }
+ return null;
+ }
+}