--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Copyright © 2017 Ericsson India Global Services Pvt Ltd. 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">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.opendaylight.genius</groupId>
+ <artifactId>config-parent</artifactId>
+ <version>0.4.0-SNAPSHOT</version>
+ <relativePath>../../commons/config-parent</relativePath>
+ </parent>
+
+ <groupId>org.opendaylight.genius</groupId>
+ <artifactId>srm-api</artifactId>
+ <version>0.4.0-SNAPSHOT</version>
+ <packaging>bundle</packaging>
+ <!-- <name> formatting is used by autorelease to parse and notify projects on
+ build failure. Please do not modify this unless you have a good reason. -->
+ <name>ODL :: genius :: ${project.artifactId}</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.opendaylight.mdsal</groupId>
+ <artifactId>yang-binding</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>yang-common</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ <configuration>
+ <propertyExpansion>checkstyle.violationSeverity=error</propertyExpansion>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
--- /dev/null
+module srm-ops {
+ namespace "urn:opendaylight:genius:srm:ops";
+ prefix "srmops";
+
+ import srm-types {
+ prefix srmtype;
+ }
+
+ revision "2017-07-11" {
+ description "ODL Services Recovery Manager Operations Model";
+ }
+
+ /* Operations */
+
+ container service-ops {
+ config false;
+ list services {
+ key service-name;
+ leaf service-name {
+ type identityref {
+ base srmtype:entity-name-base;
+ }
+ }
+ list operations {
+ key entity-name;
+ leaf entity-name {
+ type identityref {
+ base srmtype:entity-name-base;
+ }
+ }
+ leaf entity-type {
+ type identityref {
+ base srmtype:entity-type-base;
+ }
+ }
+ leaf entity-id {
+ description "Optional when entity-type is service. Actual
+ id depends on entity-type and entity-name";
+ type string;
+ }
+ leaf trigger-operation {
+ type identityref {
+ base srmtypes:service-op-base;
+ }
+ }
+ }
+ }
+ }
+
+}
\ No newline at end of file
--- /dev/null
+module srm-rpcs {
+ namespace "urn:opendaylight:genius:srm:rpcs";
+ prefix "srmrpcs";
+
+ import srm-types {
+ prefix srmtype;
+ }
+
+ revision "2017-07-11" {
+ description "ODL Services Recovery Manager Rpcs Module";
+ }
+
+ /* RPCs */
+
+ rpc reinstall {
+ description "Reinstall a given service";
+ input {
+ leaf entity-name {
+ type identityref {
+ base srmtype:entity-name-base;
+ }
+ }
+ leaf entity-type {
+ description "Currently supported entity-types:
+ service";
+ type identityref {
+ base srmtype:entity-type-base;
+ }
+ }
+ }
+ output {
+ leaf successful {
+ type boolean;
+ }
+ leaf message {
+ type string;
+ }
+ }
+ }
+
+
+ rpc recover {
+ description "Recover a given service or instance";
+ input {
+ leaf entity-name {
+ type identityref {
+ base srmtype:entity-name-base;
+ }
+ }
+ leaf entity-type {
+ description "Currently supported entity-types:
+ service, instance";
+ type identityref {
+ base srmtype:entity-type-base;
+ }
+ }
+ leaf entity-id {
+ description "Optional when entity-type is service. Actual
+ id depends on entity-type and entity-name";
+ type string;
+ }
+ }
+ output {
+ leaf response {
+ type identityref {
+ base rpc-result-base;
+ }
+ }
+ leaf message {
+ type string;
+ }
+ }
+ }
+
+ /* RPC RESULTs */
+
+ identity rpc-result-base {
+ description "Base identity for all SRM RPC Results";
+ }
+ identity rpc-success {
+ description "RPC result successful";
+ base rpc-result-base;
+ }
+ identity rpc-fail-op-not-supported {
+ description "RPC failed:
+ operation not supported for given parameters";
+ base rpc-result-base;
+ }
+ identity rpc-fail-entity-type {
+ description "RPC failed:
+ invalid entity type";
+ base rpc-result-base;
+ }
+ identity rpc-fail-entity-name {
+ description "RPC failed:
+ invalid entity name";
+ base rpc-result-base;
+ }
+ identity rpc-fail-entity-id {
+ description "RPC failed:
+ invalid entity id";
+ base rpc-result-base;
+ }
+ identity rpc-fail-unknown {
+ description "RPC failed:
+ reason not known, check message string for details";
+ base rpc-result-base;
+ }
+}
\ No newline at end of file
--- /dev/null
+module srm-types {
+ namespace "urn:opendaylight:genius:srm:types";
+ prefix "srmtypes";
+
+ revision "2017-07-11" {
+ description "ODL Services Recovery Manager Types Module";
+ }
+
+ /* Entity TYPEs */
+
+ identity entity-type-base {
+ description "Base identity for all srm entity types";
+ }
+ identity entity-type-service {
+ description "SRM Entity type service";
+ base entity-type-base;
+ }
+ identity entity-type-instance {
+ description "SRM Entity type instance";
+ base entity-type-base;
+ }
+
+
+ /* Entity NAMEs */
+
+ /* Entity Type SERVICE names */
+ identity entity-name-base {
+ description "Base identity for all srm entity names";
+ }
+ identity genius-ifm {
+ description "SRM Entity name for IFM service";
+ base entity-name-base;
+ }
+ identity genius-itm {
+ description "SRM Entity name for ITM service";
+ base entity-name-base;
+ }
+ identity netvirt-vpn {
+ description "SRM Entity name for VPN service";
+ base entity-name-base;
+ }
+ identity netvirt-elan {
+ description "SRM Entity name for elan service";
+ base entity-name-base;
+ }
+ identity ofplugin {
+ description "SRM Entity name for openflowplugin service";
+ base entity-name-base;
+ }
+
+
+ /* Entity Type INSTANCE Names */
+
+ /* Entity names supported by GENIUS */
+ identity genius-itm-tep {
+ description "SRM Entity name for ITM's tep instance";
+ base entity-name-base;
+ }
+ identity genius-itm-tz {
+ description "SRM Entity name for ITM's transportzone instance";
+ base entity-name-base;
+ }
+
+ identity genius-ifm-interface {
+ description "SRM Entity name for IFM's interface instance";
+ base entity-name-base;
+ }
+
+ /* Entity names supported by NETVIRT */
+ identity netvirt-vpn-instance {
+ description "SRM Entity name for VPN instance";
+ base entity-name-base;
+ }
+
+ identity netvirt-elan-instance {
+ description "SRM Entity name for ELAN instance";
+ base entity-name-base;
+ }
+
+
+ /* Service operations */
+ identity service-op-base {
+ description "Base identity for all srm operations";
+ }
+ identity service-op-reinstall {
+ description "Reinstall a service";
+ base service-op-base;
+ }
+ identity service-op-recover {
+ description "Recover a service or instance";
+ base service-op-base;
+ }
+
+}
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Copyright © 2017 Ericsson India Global Services Pvt Ltd. 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">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.opendaylight.genius</groupId>
+ <artifactId>config-parent</artifactId>
+ <version>0.4.0-SNAPSHOT</version>
+ <relativePath>../../commons/config-parent</relativePath>
+ </parent>
+
+ <groupId>org.opendaylight.genius</groupId>
+ <artifactId>srm-impl</artifactId>
+ <version>0.4.0-SNAPSHOT</version>
+ <packaging>bundle</packaging>
+ <!-- <name> formatting is used by autorelease to parse and notify projects on
+ build failure. Please do not modify this unless you have a good reason. -->
+ <name>ODL :: genius :: ${project.artifactId}</name>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>srm-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>sal-binding-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>javax.inject</groupId>
+ <artifactId>javax.inject</artifactId>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.eclipse.xtend</groupId>
+ <artifactId>xtend-maven-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.aries.blueprint</groupId>
+ <artifactId>blueprint-maven-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ <configuration>
+ <propertyExpansion>checkstyle.violationSeverity=error</propertyExpansion>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
--- /dev/null
+/*
+ * Copyright (c) 2017 Ericsson India Global Services Pvt Ltd. 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.genius.srm;
+
+import com.google.common.util.concurrent.Futures;
+import java.util.concurrent.Future;
+import javax.inject.Inject;
+import javax.inject.Singleton;
+import org.opendaylight.controller.md.sal.binding.api.DataBroker;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.srm.rpcs.rev170711.RecoverInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.srm.rpcs.rev170711.RecoverOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.srm.rpcs.rev170711.ReinstallInput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.srm.rpcs.rev170711.ReinstallOutput;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.srm.rpcs.rev170711.SrmRpcsService;
+import org.opendaylight.yangtools.yang.common.RpcError.ErrorType;
+import org.opendaylight.yangtools.yang.common.RpcResult;
+import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@Singleton
+public class SrmRpcProvider implements SrmRpcsService {
+
+ private static final Logger LOG = LoggerFactory.getLogger(SrmRpcProvider.class);
+
+ private final DataBroker dataBroker;
+
+ @Inject
+ public SrmRpcProvider(final DataBroker dataBroker) {
+ this.dataBroker = dataBroker;
+ }
+
+ @Override
+ public Future<RpcResult<RecoverOutput>> recover(RecoverInput input) {
+ LOG.trace("recover() called with {}", input);
+ RpcResultBuilder resultBuilder = RpcResultBuilder.failed()
+ .withError(ErrorType.APPLICATION, "Not implemented yet");
+ return Futures.immediateFuture(resultBuilder.build());
+ }
+
+
+ @Override
+ public Future<RpcResult<ReinstallOutput>> reinstall(ReinstallInput input) {
+ LOG.trace("reinstall() called with {}", input);
+ RpcResultBuilder resultBuilder = RpcResultBuilder.failed()
+ .withError(ErrorType.APPLICATION, "Not implemented yet");
+ return Futures.immediateFuture(resultBuilder.build());
+ }
+
+}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Copyright © 2017 Ericsson India Global Services Pvt Ltd. 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
+-->
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+ xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
+ odl:use-default-for-reference-types="true">
+
+ <reference id="dataBroker"
+ interface="org.opendaylight.controller.md.sal.binding.api.DataBroker" />
+
+ <odl:rpc-implementation ref="srmRpcProvider" />
+
+</blueprint>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Copyright (c) 2017 Ericsson India Global Services Pvt Ltd. 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 INTERNAL
+-->
+<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.opendaylight.odlparent</groupId>
+ <artifactId>odlparent-lite</artifactId>
+ <version>2.0.4</version>
+ <relativePath/>
+ </parent>
+
+ <groupId>org.opendaylight.genius</groupId>
+ <artifactId>srm-aggregator</artifactId>
+ <version>0.4.0-SNAPSHOT</version>
+ <!-- <name> formatting is used by autorelease to parse and notify projects on
+ build failure. Please do not modify this unless you have a good reason. -->
+ <name>ODL :: genius :: ${project.artifactId}</name>
+ <packaging>pom</packaging>
+
+ <modules>
+ <module>api</module>
+ <module>impl</module>
+ <module>shell</module>
+ </modules>
+
+ <!-- DO NOT install or deploy the repo root pom as it's only needed to initiate a build -->
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-deploy-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-install-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- vi: set et smarttab sw=4 tabstop=4: --><!--
+Copyright (c) 2017 Ericsson India Global Services Pvt Ltd. 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.genius</groupId>
+ <artifactId>config-parent</artifactId>
+ <version>0.4.0-SNAPSHOT</version>
+ <relativePath>../../commons/config-parent</relativePath>
+ </parent>
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>org.opendaylight.genius</groupId>
+ <artifactId>srm-shell</artifactId>
+ <version>${genius.version}</version>
+ <packaging>bundle</packaging>
+ <!-- <name> formatting is used by autorelease to parse and notify projects on
+ build failure. Please do not modify this unless you have a good reason. -->
+ <name>ODL :: genius :: ${project.artifactId}</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.opendaylight.genius</groupId>
+ <artifactId>srm-api</artifactId>
+ <version>${genius.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.opendaylight.controller</groupId>
+ <artifactId>sal-binding-api</artifactId>
+ <version>${controller.mdsal.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.karaf.shell</groupId>
+ <artifactId>org.apache.karaf.shell.console</artifactId>
+ </dependency>
+ </dependencies>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-checkstyle-plugin</artifactId>
+ <configuration>
+ <propertyExpansion>checkstyle.violationSeverity=error</propertyExpansion>
+ </configuration>
+ </plugin>
+ <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, see https://wiki.opendaylight.org/view/Karaf_4_migration#Karaf_CLI_commands -->
+ <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>
+</project>
--- /dev/null
+/*
+ * Copyright (c) 2017 Ericsson India Global Services Pvt Ltd. 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.genius.srm.shell;
+
+import org.apache.karaf.shell.commands.Argument;
+import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.console.OsgiCommandSupport;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.srm.rpcs.rev170711.SrmRpcsService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@Command(scope = "srm", name = "recover", description = "Recover service or instance")
+public class RecoverCommand extends OsgiCommandSupport {
+
+ private static final Logger LOG = LoggerFactory.getLogger(RecoverCommand.class);
+
+ private final SrmRpcsService srmRpcService;
+
+ public RecoverCommand(SrmRpcsService srmRpcService) {
+ this.srmRpcService = srmRpcService;
+ }
+
+ @Argument(index = 0, name = "type", description = "EntityType, required", required = false, multiValued = false)
+ String type;
+
+ @Argument(index = 1, name = "name", description = "EntityName, required", required = false, multiValued = false)
+ String name;
+
+ @Argument(index = 2, name = "id", description = "EntityId, optional", required = false, multiValued = false)
+ String id;
+
+ @Override
+ protected Object doExecute() throws Exception {
+ session.getConsole().println(getHelp());
+ return null;
+ }
+
+ private String getHelp() {
+ StringBuilder help = new StringBuilder("Usage:");
+ help.append("srm:recover <type> <name> [ <id> ]\n");
+ return help.toString();
+ }
+
+}
--- /dev/null
+/*
+ * Copyright (c) 2017 Ericsson India Global Services Pvt Ltd. 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.genius.srm.shell;
+
+import org.apache.karaf.shell.commands.Argument;
+import org.apache.karaf.shell.commands.Command;
+import org.apache.karaf.shell.console.OsgiCommandSupport;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.srm.rpcs.rev170711.SrmRpcsService;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.srm.types.rev170711.EntityTypeBase;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.genius.srm.types.rev170711.EntityTypeService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@Command(scope = "srm", name = "reinstall", description = "Reinstall service or instance")
+public class ReinstallCommand extends OsgiCommandSupport {
+
+ private static final Logger LOG = LoggerFactory.getLogger(ReinstallCommand.class);
+
+ private SrmRpcsService srmRpcService;
+ private final Class<? extends EntityTypeBase> entityType = EntityTypeService.class;
+
+
+ public ReinstallCommand(SrmRpcsService srmRpcService) {
+ this.srmRpcService = srmRpcService;
+ }
+
+ @Argument(index = 0, name = "name", description = "EntityName of type service, required",
+ required = false, multiValued = false)
+ String name;
+
+ @Override
+ protected Object doExecute() throws Exception {
+ session.getConsole().println(getHelp());
+ return null;
+ }
+
+ private String getHelp() {
+ StringBuilder help = new StringBuilder("Usage:");
+ help.append("srm:reinstall <name>\n");
+ return help.toString();
+ }
+
+}
--- /dev/null
+<!-- * Copyright (c) 2017 Ericsson India Global Services Pvt Ltd. 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
+-->
+
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+ xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0"
+ odl:use-default-for-reference-types="true">
+
+ <odl:rpc-service id="srmRpcService"
+ interface="org.opendaylight.yang.gen.v1.urn.opendaylight.genius.srm.rpcs.rev170711.SrmRpcsService" />
+
+ <command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.1.0">
+ <command>
+ <action class="org.opendaylight.genius.srm.shell.RecoverCommand">
+ <argument ref="srmRpcService" />
+ </action>
+ </command>
+ <command>
+ <action class="org.opendaylight.genius.srm.shell.ReinstallCommand">
+ <argument ref="srmRpcService" />
+ </action>
+ </command>
+ </command-bundle>
+</blueprint>