<type>xml</type>
<classifier>config-segment</classifier>
</dependency>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>pcep-controller-config</artifactId>
- <version>${project.version}</version>
- <type>xml</type>
- <classifier>config-auto-bw</classifier>
- </dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<type>xml</type>
<classifier>config-segment</classifier>
</dependency>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>pcep-controller-config</artifactId>
- <type>xml</type>
- <classifier>config-auto-bw</classifier>
- </dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>pcep-controller-config</artifactId>
<feature name='odl-bgpcep-pcep-auto-bandwidth' version='${project.version}'>
<feature version='${project.version}'>odl-bgpcep-pcep-stateful07</feature>
<bundle>mvn:org.opendaylight.bgpcep/pcep-auto-bandwidth-extension/{{VERSION}}</bundle>
- <configfile finalname="etc/opendaylight/karaf/34-pcep-auto-bandwidth.xml">mvn:org.opendaylight.bgpcep/pcep-controller-config/{{VERSION}}/xml/config-auto-bw</configfile>
</feature>
</features>
+++ /dev/null
-/*
- * Copyright (c) 2016 Cisco Systems, 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.controller.config.yang.pcep.auto.bandwidth.cfg;
-
-import org.opendaylight.controller.config.api.DependencyResolver;
-import org.opendaylight.controller.config.api.JmxAttributeValidationException;
-import org.opendaylight.controller.config.api.ModuleIdentifier;
-import org.opendaylight.protocol.pcep.auto.bandwidth.extension.Activator;
-
-public class AutoBandwidthPCEPParserModule extends AbstractAutoBandwidthPCEPParserModule {
-
- private static final int BW_TYPE_RANGE_LOW = 3;
- private static final int BW_TYPE_RANGE_UP = 15;
-
- public AutoBandwidthPCEPParserModule(final ModuleIdentifier identifier, final DependencyResolver dependencyResolver) {
- super(identifier, dependencyResolver);
- }
-
- public AutoBandwidthPCEPParserModule(final ModuleIdentifier identifier, final DependencyResolver dependencyResolver, final AutoBandwidthPCEPParserModule oldModule, final AutoCloseable oldInstance) {
- super(identifier, dependencyResolver, oldModule, oldInstance);
- }
-
- @Override
- public void customValidation() {
- //values 3-15 are unassigned - http://www.iana.org/assignments/pcep/pcep.xhtml#pcep-objects
- JmxAttributeValidationException.checkCondition(getBandwidthUsageObjectType() >= BW_TYPE_RANGE_LOW &&
- getBandwidthUsageObjectType() <= BW_TYPE_RANGE_UP, "out of range 3..15", bandwidthUsageObjectTypeJmxAttribute);
- }
-
- @Override
- public AutoCloseable createInstance() {
- return new Activator(getBandwidthUsageObjectType());
- }
-
-}
+++ /dev/null
-/*
- * Copyright (c) 2016 Cisco Systems, 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.controller.config.yang.pcep.auto.bandwidth.cfg;
-
-public class AutoBandwidthPCEPParserModuleFactory extends AbstractAutoBandwidthPCEPParserModuleFactory {
-
-}
package org.opendaylight.protocol.pcep.auto.bandwidth.extension;
+import com.google.common.annotations.VisibleForTesting;
import java.util.ArrayList;
import java.util.List;
import org.opendaylight.protocol.pcep.spi.PCEPExtensionProviderContext;
private final int bandwidthUsageObjectType;
+ @VisibleForTesting
+ public Activator() {
+ this(1);
+ }
+
public Activator(final int bandwidthUsageObjectType) {
this.bandwidthUsageObjectType = bandwidthUsageObjectType;
}
--- /dev/null
+# Copyright (c) 2016 Brocade Communications Systems, 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
+org.opendaylight.protocol.pcep.auto.bandwidth.extension.Activator
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+ xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0">
+
+ <odl:clustered-app-config id="autoBandwidthAppConfig"
+ binding-class="org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.auto.bandwidth.app.config.rev160707.PcepAutoBandwidthAppConfig"/>
+
+ <bean id="autoBandwidthActivator" class="org.opendaylight.protocol.pcep.auto.bandwidth.extension.Activator">
+ <argument>
+ <bean factory-ref="autoBandwidthAppConfig" factory-method="getBandwidthUsageObjectType"/>
+ </argument>
+ </bean>
+
+ <service ref="autoBandwidthActivator" interface="org.opendaylight.protocol.pcep.spi.PCEPExtensionProviderActivator"
+ odl:type="org.opendaylight.protocol.pcep.auto.bandwidth.extension.Activator"/>
+</blueprint>
\ No newline at end of file
+++ /dev/null
-module odl-pcep-auto-bandwidth-cfg {
- yang-version 1;
- namespace "urn:opendaylight:params:xml:ns:yang:controller:pcep:auto:bandwidth:cfg";
- prefix "auto-bw-cfg";
-
- import config { prefix config; revision-date 2013-04-05; }
- import odl-pcep-api-cfg { prefix pcep; revision-date 2013-04-09; }
- import odl-pcep-spi-cfg { prefix spi; revision-date 2013-11-15; }
-
- organization "Cisco Systems, Inc.";
-
- contact "Milos Fabian <milfabia@cisco.com>";
-
- description
- "This module contains the base YANG definitions for
- draft-ietf-pce-stateful-pce-07 extensions configuration.
-
- Copyright (c)2016 Cisco Systems, Inc. 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";
-
- revision 2016-01-09 {
- description "Initial revision";
- }
-
- identity pcep-parser-auto-bandwidth {
- base config:module-type;
- config:provided-service spi:extension;
- config:java-name-prefix AutoBandwidthPCEPParser;
- }
-
- augment "/config:modules/config:module/config:configuration" {
- case pcep-parser-auto-bandwidth {
- when "/config:modules/config:module/config:type = 'pcep-parser-auto-bandwidth'";
- leaf bandwidth-usage-object-type {
- type uint8;
- default 5;
- }
- }
- }
-
-}
\ No newline at end of file
--- /dev/null
+module pcep-auto-bandwidth-app-config {
+ yang-version 1;
+ namespace "urn:opendaylight:params:xml:ns:yang:controller:pcep:auto-bandwidth-app-config";
+ prefix "pcep-auto-bandwidth-app-config";
+
+ description
+ "Configuration for the PCEP auto bandwidth extension.";
+
+ revision "2016-07-07" {
+ description
+ "Initial revision.";
+ }
+
+ container pcep-auto-bandwidth-app-config {
+ leaf bandwidth-usage-object-type {
+ type uint16 {
+ range "3..15";
+ }
+
+ default 5;
+ }
+ }
+}
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright (c) 2016 Cisco Systems, 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.controller.config.yang.pcep.auto.bandwidth.cfg;
-
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.Mockito;
-import org.opendaylight.controller.config.api.DependencyResolver;
-import org.opendaylight.controller.config.api.JmxAttributeValidationException;
-import org.opendaylight.protocol.pcep.auto.bandwidth.extension.Activator;
-
-public class AutoBandwidthPCEPParserModuleTest {
-
- private static final AutoBandwidthPCEPParserModuleFactory FACTORY = new AutoBandwidthPCEPParserModuleFactory();
-
- private AutoBandwidthPCEPParserModule module;
-
- @Before
- public void setUp() {
- final DependencyResolver dependencyResolver = Mockito.mock(DependencyResolver.class);
- this.module = (AutoBandwidthPCEPParserModule) FACTORY.createModule("instance", dependencyResolver, null);
- }
-
- @Test
- public void testCreateInsatnce() {
- final AutoCloseable instance = module.createInstance();
- Assert.assertTrue(instance instanceof Activator);
- }
-
- @Test
- public void testCustomValidationLowerBound() {
- try {
- this.module.setBandwidthUsageObjectType((short) 3);
- this.module.customValidation();
- } catch (final JmxAttributeValidationException e) {
- Assert.fail(e.getMessage());
- }
-
- try {
- this.module.setBandwidthUsageObjectType((short) 2);
- this.module.customValidation();
- Assert.fail();
- } catch (final JmxAttributeValidationException e) {
- Assert.assertTrue(e.getMessage().startsWith("BandwidthUsageObjectType out of range"));
- }
-
- }
-
- @Test
- public void testCustomValidationUpperBound() {
- try {
- this.module.setBandwidthUsageObjectType((short) 15);
- this.module.customValidation();
- } catch (final JmxAttributeValidationException e) {
- Assert.fail(e.getMessage());
- }
-
- try {
- this.module.setBandwidthUsageObjectType((short) 16);
- this.module.customValidation();
- Assert.fail();
- } catch (final JmxAttributeValidationException e) {
- Assert.assertTrue(e.getMessage().startsWith("BandwidthUsageObjectType out of range"));
- }
-
- }
-
-}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+ xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0">
+
+ <bean id="baseParserActivator" class="org.opendaylight.protocol.pcep.parser.BaseParserExtensionActivator"/>
+
+ <service ref="baseParserActivator" interface="org.opendaylight.protocol.pcep.spi.PCEPExtensionProviderActivator"
+ odl:type="org.opendaylight.protocol.pcep.parser.BaseParserExtensionActivator"/>
+</blueprint>
\ No newline at end of file
<type>xml</type>
<classifier>config-segment</classifier>
</artifact>
- <artifact>
- <file>${project.build.directory}/classes/initial/34-pcep-auto-bandwidth.xml</file>
- <type>xml</type>
- <classifier>config-auto-bw</classifier>
- </artifact>
<artifact>
<file>${project.build.directory}/classes/initial/39-pcep-provider.xml</file>
<type>xml</type>
<module>
<type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:pcep:spi">prefix:pcep-extensions-impl</type>
<name>global-pcep-extensions</name>
- <extension>
- <type xmlns:pcepspi="urn:opendaylight:params:xml:ns:yang:controller:pcep:spi">pcepspi:extension</type>
- <name>pcep-parser-base</name>
- </extension>
-
- <!-- This block is draft-ietf-pce-stateful-pce-07 + draft-ietf-pce-inititated-pce-00 -->
- <extension>
- <type xmlns:pcepspi="urn:opendaylight:params:xml:ns:yang:controller:pcep:spi">pcepspi:extension</type>
- <name>pcep-parser-ietf-stateful07</name>
- </extension>
- <extension>
- <type xmlns:pcepspi="urn:opendaylight:params:xml:ns:yang:controller:pcep:spi">pcepspi:extension</type>
- <name>pcep-parser-ietf-initiated00</name>
- </extension>
- <extension>
- <type xmlns:pcepspi="urn:opendaylight:params:xml:ns:yang:controller:pcep:spi">pcepspi:extension</type>
- <name>pcep-parser-sync-optimizations</name>
- </extension>
- </module>
- <module>
- <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:pcep:impl">prefix:pcep-parser-base</type>
- <name>pcep-parser-base</name>
- </module>
- <module>
- <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:pcep:stateful07:cfg">prefix:pcep-parser-ietf-stateful07</type>
- <name>pcep-parser-ietf-stateful07</name>
- </module>
- <module>
- <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:pcep:stateful07:cfg">prefix:pcep-parser-ietf-initiated00</type>
- <name>pcep-parser-ietf-initiated00</name>
- </module>
- <module>
- <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:pcep:stateful07:cfg">prefix:pcep-parser-sync-optimizations</type>
- <name>pcep-parser-sync-optimizations</name>
</module>
<module>
<type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:pcep:stateful07:cfg">prefix:stateful-capability</type>
<provider>/config/modules/module[name='pcep-extensions-impl']/instance[name='global-pcep-extensions']</provider>
</instance>
</service>
- <service>
- <type xmlns:pcepspi="urn:opendaylight:params:xml:ns:yang:controller:pcep:spi">pcepspi:extension</type>
- <instance>
- <name>pcep-parser-base</name>
- <provider>/config/modules/module[name='pcep-parser-base']/instance[name='pcep-parser-base']</provider>
- </instance>
- <instance>
- <name>pcep-parser-ietf-initiated00</name>
- <provider>/config/modules/module[name='pcep-parser-ietf-initiated00']/instance[name='pcep-parser-ietf-initiated00']</provider>
- </instance>
- <instance>
- <name>pcep-parser-ietf-stateful07</name>
- <provider>/config/modules/module[name='pcep-parser-ietf-stateful07']/instance[name='pcep-parser-ietf-stateful07']</provider>
- </instance>
- <instance>
- <name>pcep-parser-sync-optimizations</name>
- <provider>/config/modules/module[name='pcep-parser-sync-optimizations']/instance[name='pcep-parser-sync-optimizations']</provider>
- </instance>
- </service>
<service>
<type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:pcep">prefix:pcep-capability</type>
<instance>
<configuration>
<data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<modules xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
- <module>
- <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:pcep:spi">prefix:pcep-extensions-impl</type>
- <name>global-pcep-extensions</name>
- <extension>
- <type xmlns:pcepspi="urn:opendaylight:params:xml:ns:yang:controller:pcep:spi">pcepspi:extension</type>
- <name>pcep-parser-segment-routing</name>
- </extension>
- </module>
- <module>
- <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:pcep:sr:cfg">prefix:pcep-parser-segment-routing</type>
- <name>pcep-parser-segment-routing</name>
- <!-- Proposed code point for SR-ERO/RRO subobject by draft (=36) https://tools.ietf.org/html/draft-ietf-pce-segment-routing-06.
- to preserve (TYPE = 5/6) assigned type set the value to false or remove (false by default) or set true to use proposed ones
- <iana-sr-subobjects-type>true</iana-sr-subobjects-type>-->
- </module>
<module>
<type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:pcep:sr:cfg">prefix:pcep-segment-routing-capability</type>
<name>pcep-segment-routing-capability</name>
</module>
</modules>
<services xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
- <service>
- <type xmlns:pcepspi="urn:opendaylight:params:xml:ns:yang:controller:pcep:spi">pcepspi:extension</type>
- <instance>
- <name>pcep-parser-segment-routing</name>
- <provider>/config/modules/module[name='pcep-parser-segment-routing']/instance[name='pcep-parser-segment-routing']</provider>
- </instance>
- </service>
<service>
<type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:pcep">prefix:pcep-capability</type>
<instance>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<snapshot>
- <required-capabilities>
- <capability>urn:opendaylight:params:xml:ns:yang:controller:pcep:impl?module=odl-pcep-impl-cfg&revision=2013-06-27</capability>
- <capability>urn:opendaylight:params:xml:ns:yang:controller:pcep:spi?module=odl-pcep-spi-cfg&revision=2013-11-15</capability>
- <capability>urn:opendaylight:params:xml:ns:yang:controller:pcep:auto:bandwidth:cfg?module=odl-pcep-auto-bandwidth-cfg&revision=2016-01-09</capability>
- </required-capabilities>
- <configuration>
- <data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
- <modules xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
- <module>
- <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:pcep:spi">prefix:pcep-extensions-impl</type>
- <name>global-pcep-extensions</name>
- <extension>
- <type xmlns:pcepspi="urn:opendaylight:params:xml:ns:yang:controller:pcep:spi">pcepspi:extension</type>
- <name>pcep-parser-auto-bandwidth</name>
- </extension>
- </module>
- <module>
- <type xmlns:prefix="urn:opendaylight:params:xml:ns:yang:controller:pcep:auto:bandwidth:cfg">prefix:pcep-parser-auto-bandwidth</type>
- <name>pcep-parser-auto-bandwidth</name>
- <!--<bandwidth-usage-object-type>5</bandwidth-usage-object-type>-->
- </module>
- </modules>
- <services xmlns="urn:opendaylight:params:xml:ns:yang:controller:config">
- <service>
- <type xmlns:pcepspi="urn:opendaylight:params:xml:ns:yang:controller:pcep:spi">pcepspi:extension</type>
- <instance>
- <name>pcep-parser-auto-bandwidth</name>
- <provider>/config/modules/module[name='pcep-parser-auto-bandwidth']/instance[name='pcep-parser-auto-bandwidth']</provider>
- </instance>
- </service>
- </services>
- </data>
- </configuration>
-</snapshot>
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright (c) 2014 Cisco Systems, 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
- */
-/**
- * Generated file
-
- * Generated from: yang module name: odl-pcep-impl-cfg yang module local name: pcep-parser-ietf-initiated00
- * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
- * Generated at: Wed Jan 22 14:05:37 CET 2014
- *
- * Do not modify this file unless it is present under src/main directory
- */
-package org.opendaylight.controller.config.yang.pcep.stateful07.cfg;
-
-import org.opendaylight.protocol.pcep.ietf.initiated00.CrabbeInitiatedActivator;
-
-/**
-*
-*/
-public final class IetfInitiated00PCEPParserModule extends
- org.opendaylight.controller.config.yang.pcep.stateful07.cfg.AbstractIetfInitiated00PCEPParserModule {
-
- public IetfInitiated00PCEPParserModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier,
- final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
- super(identifier, dependencyResolver);
- }
-
- public IetfInitiated00PCEPParserModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier,
- final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver,
- final IetfInitiated00PCEPParserModule oldModule, final java.lang.AutoCloseable oldInstance) {
-
- super(identifier, dependencyResolver, oldModule, oldInstance);
- }
-
- @Override
- public java.lang.AutoCloseable createInstance() {
- return new CrabbeInitiatedActivator();
- }
-}
+++ /dev/null
-/*
- * Copyright (c) 2014 Cisco Systems, 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
- */
-/**
- * Generated file
-
- * Generated from: yang module name: odl-pcep-impl-cfg yang module local name: pcep-parser-ietf-initiated00
- * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
- * Generated at: Wed Jan 22 14:05:37 CET 2014
- *
- * Do not modify this file unless it is present under src/main directory
- */
-package org.opendaylight.controller.config.yang.pcep.stateful07.cfg;
-
-/**
-*
-*/
-public class IetfInitiated00PCEPParserModuleFactory extends
- org.opendaylight.controller.config.yang.pcep.stateful07.cfg.AbstractIetfInitiated00PCEPParserModuleFactory {
-
-}
+++ /dev/null
-/*
- * Copyright (c) 2014 Cisco Systems, 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
- */
-/**
- * Generated file
-
- * Generated from: yang module name: odl-pcep-impl-cfg yang module local name: pcep-parser-ietf-stateful07
- * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
- * Generated at: Wed Jan 22 14:05:37 CET 2014
- *
- * Do not modify this file unless it is present under src/main directory
- */
-package org.opendaylight.controller.config.yang.pcep.stateful07.cfg;
-
-import org.opendaylight.protocol.pcep.ietf.stateful07.StatefulActivator;
-
-/**
-*
-*/
-public final class IetfStateful07PCEPParserModule extends
- org.opendaylight.controller.config.yang.pcep.stateful07.cfg.AbstractIetfStateful07PCEPParserModule {
-
- public IetfStateful07PCEPParserModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier,
- final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
- super(identifier, dependencyResolver);
- }
-
- public IetfStateful07PCEPParserModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier,
- final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver,
- final IetfStateful07PCEPParserModule oldModule, final java.lang.AutoCloseable oldInstance) {
-
- super(identifier, dependencyResolver, oldModule, oldInstance);
- }
-
- @Override
- public java.lang.AutoCloseable createInstance() {
- return new StatefulActivator();
- }
-}
+++ /dev/null
-/*
- * Copyright (c) 2014 Cisco Systems, 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
- */
-/**
- * Generated file
-
- * Generated from: yang module name: odl-pcep-impl-cfg yang module local name: pcep-parser-ietf-stateful07
- * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
- * Generated at: Wed Jan 22 14:05:37 CET 2014
- *
- * Do not modify this file unless it is present under src/main directory
- */
-package org.opendaylight.controller.config.yang.pcep.stateful07.cfg;
-
-/**
-*
-*/
-public class IetfStateful07PCEPParserModuleFactory extends
- org.opendaylight.controller.config.yang.pcep.stateful07.cfg.AbstractIetfStateful07PCEPParserModuleFactory {
-
-}
+++ /dev/null
-/*
- * Copyright (c) 2015 Cisco Systems, 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.controller.config.yang.pcep.stateful07.cfg;
-
-import org.opendaylight.controller.config.api.DependencyResolver;
-import org.opendaylight.controller.config.api.ModuleIdentifier;
-import org.opendaylight.protocol.pcep.sync.optimizations.SyncOptimizationsActivator;
-
-public class SyncOptimizationsPCEPParserModule extends AbstractSyncOptimizationsPCEPParserModule {
-
- public SyncOptimizationsPCEPParserModule(final ModuleIdentifier identifier, final DependencyResolver dependencyResolver) {
- super(identifier, dependencyResolver);
- }
-
- public SyncOptimizationsPCEPParserModule(final ModuleIdentifier identifier, final DependencyResolver dependencyResolver,
- final SyncOptimizationsPCEPParserModule oldModule, final java.lang.AutoCloseable oldInstance) {
- super(identifier, dependencyResolver, oldModule, oldInstance);
- }
-
- @Override
- protected AutoCloseable createInstance() {
- return new SyncOptimizationsActivator();
- }
-
-}
+++ /dev/null
-/*
- * Copyright (c) 2015 Cisco Systems, 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.controller.config.yang.pcep.stateful07.cfg;
-
-public class SyncOptimizationsPCEPParserModuleFactory extends AbstractSyncOptimizationsPCEPParserModuleFactory {
-
-}
org.opendaylight.protocol.pcep.ietf.stateful07.StatefulActivator
org.opendaylight.protocol.pcep.ietf.initiated00.CrabbeInitiatedActivator
+org.opendaylight.protocol.pcep.sync.optimizations.SyncOptimizationsActivator
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+ xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0">
+
+ <bean id="ietfStateful07Activator" class="org.opendaylight.protocol.pcep.ietf.stateful07.StatefulActivator"/>
+ <service ref="ietfStateful07Activator" interface="org.opendaylight.protocol.pcep.spi.PCEPExtensionProviderActivator"
+ odl:type="org.opendaylight.protocol.pcep.ietf.stateful07.StatefulActivator"/>
+
+ <bean id="ietfInitiated00Activator" class="org.opendaylight.protocol.pcep.ietf.initiated00.CrabbeInitiatedActivator"/>
+ <service ref="ietfInitiated00Activator" interface="org.opendaylight.protocol.pcep.spi.PCEPExtensionProviderActivator"
+ odl:type="org.opendaylight.protocol.pcep.ietf.initiated00.CrabbeInitiatedActivator"/>
+
+ <bean id="syncOptimizationsActivator" class="org.opendaylight.protocol.pcep.sync.optimizations.SyncOptimizationsActivator"/>
+ <service ref="syncOptimizationsActivator" interface="org.opendaylight.protocol.pcep.spi.PCEPExtensionProviderActivator"
+ odl:type="org.opendaylight.protocol.pcep.sync.optimizations.SyncOptimizationsActivator"/>
+</blueprint>
\ No newline at end of file
uses stateful-capabilities;
}
}
-
- identity pcep-parser-ietf-stateful07 {
- base config:module-type;
- config:provided-service spi:extension;
- config:java-name-prefix IetfStateful07PCEPParser;
- }
-
- augment "/config:modules/config:module/config:configuration" {
- case pcep-parser-ietf-stateful07 {
- when "/config:modules/config:module/config:type = 'pcep-parser-ietf-stateful07'";
- }
- }
-
- identity pcep-parser-ietf-initiated00 {
- base config:module-type;
- config:provided-service spi:extension;
- config:java-name-prefix IetfInitiated00PCEPParser;
- }
-
- augment "/config:modules/config:module/config:configuration" {
- case pcep-parser-ietf-initiated00 {
- when "/config:modules/config:module/config:type = 'pcep-parser-ietf-initiated00'";
- }
- }
-
- identity pcep-parser-sync-optimizations {
- base config:module-type;
- config:provided-service spi:extension;
- config:java-name-prefix SyncOptimizationsPCEPParser;
- }
-
- augment "/config:modules/config:module/config:configuration" {
- case pcep-parser-sync-optimizations {
- when "/config:modules/config:module/config:type = 'pcep-parser-sync-optimizations'";
- }
- }
}
+++ /dev/null
-/*
- * Copyright (c) 2014 Cisco Systems, 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.protocol.pcep.ietf;
-
-import com.google.common.collect.Lists;
-import javax.management.ObjectName;
-import org.junit.Before;
-import org.junit.Test;
-import org.opendaylight.controller.config.api.jmx.CommitStatus;
-import org.opendaylight.controller.config.manager.impl.AbstractConfigTest;
-import org.opendaylight.controller.config.manager.impl.factoriesresolver.HardcodedModuleFactoriesResolver;
-import org.opendaylight.controller.config.util.ConfigTransactionJMXClient;
-import org.opendaylight.controller.config.yang.pcep.spi.SimplePCEPExtensionProviderContextModuleFactory;
-import org.opendaylight.controller.config.yang.pcep.spi.SimplePCEPExtensionProviderContextModuleTest;
-import org.opendaylight.controller.config.yang.pcep.stateful07.cfg.IetfInitiated00PCEPParserModuleFactory;
-
-public class IetfInitiated00PCEPParserModuleTest extends AbstractConfigTest {
-
- private static final String FACTORY_NAME = IetfInitiated00PCEPParserModuleFactory.NAME;
- private static final String INSTANCE_NAME = "pcep-parser-ietf-initiated00-instance";
-
- @Before
- public void setUp() {
- super.initConfigTransactionManagerImpl(new HardcodedModuleFactoriesResolver(mockedContext, new IetfInitiated00PCEPParserModuleFactory(), new SimplePCEPExtensionProviderContextModuleFactory()));
- }
-
- @Test
- public void testCreateBean() throws Exception {
- CommitStatus status = createIetfInitiated00PCEPParserModuleInstance();
- assertBeanCount(1, FACTORY_NAME);
- assertStatus(status, 2, 0, 0);
- }
-
- @Test
- public void testReusingOldInstance() throws Exception {
- createIetfInitiated00PCEPParserModuleInstance();
- ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
- assertBeanCount(1, FACTORY_NAME);
- CommitStatus status = transaction.commit();
- assertBeanCount(1, FACTORY_NAME);
- assertStatus(status, 0, 0, 2);
- }
-
- private CommitStatus createIetfInitiated00PCEPParserModuleInstance() throws Exception {
- final ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
- final ObjectName baseParserON = transaction.createModule(FACTORY_NAME, INSTANCE_NAME);
-
- SimplePCEPExtensionProviderContextModuleTest.createPCEPExtensionsModuleInstance(transaction, Lists.newArrayList(baseParserON));
- return transaction.commit();
- }
-
-}
+++ /dev/null
-/*
- * Copyright (c) 2014 Cisco Systems, 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.protocol.pcep.ietf;
-
-import com.google.common.collect.Lists;
-import javax.management.ObjectName;
-import org.junit.Before;
-import org.junit.Test;
-import org.opendaylight.controller.config.api.jmx.CommitStatus;
-import org.opendaylight.controller.config.manager.impl.AbstractConfigTest;
-import org.opendaylight.controller.config.manager.impl.factoriesresolver.HardcodedModuleFactoriesResolver;
-import org.opendaylight.controller.config.util.ConfigTransactionJMXClient;
-import org.opendaylight.controller.config.yang.pcep.spi.SimplePCEPExtensionProviderContextModuleFactory;
-import org.opendaylight.controller.config.yang.pcep.spi.SimplePCEPExtensionProviderContextModuleTest;
-import org.opendaylight.controller.config.yang.pcep.stateful07.cfg.IetfStateful07PCEPParserModuleFactory;
-
-public class IetfStateful07PCEPParserModuleTest extends AbstractConfigTest {
-
- private static final String FACTORY_NAME = IetfStateful07PCEPParserModuleFactory.NAME;
- private static final String INSTANCE_NAME = "pcep-parser-ietf-stateful07-instance";
-
- @Before
- public void setUp() {
- super.initConfigTransactionManagerImpl(new HardcodedModuleFactoriesResolver(mockedContext, new IetfStateful07PCEPParserModuleFactory(), new SimplePCEPExtensionProviderContextModuleFactory()));
- }
-
- @Test
- public void testCreateBean() throws Exception {
- CommitStatus status = createStateful07PCEPParserModuleInstance();
- assertBeanCount(1, FACTORY_NAME);
- assertStatus(status, 2, 0, 0);
- }
-
- @Test
- public void testReusingOldInstance() throws Exception {
- createStateful07PCEPParserModuleInstance();
- ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
- assertBeanCount(1, FACTORY_NAME);
- CommitStatus status = transaction.commit();
- assertBeanCount(1, FACTORY_NAME);
- assertStatus(status, 0, 0, 2);
- }
-
- private CommitStatus createStateful07PCEPParserModuleInstance() throws Exception {
- final ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
- final ObjectName baseParserON = transaction.createModule(FACTORY_NAME, INSTANCE_NAME);
-
- SimplePCEPExtensionProviderContextModuleTest.createPCEPExtensionsModuleInstance(transaction, Lists.newArrayList(baseParserON));
- return transaction.commit();
- }
-
-}
+++ /dev/null
-/*
- * Copyright (c) 2015 Cisco Systems, 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.protocol.pcep.ietf;
-
-import com.google.common.collect.Lists;
-import javax.management.ObjectName;
-import org.junit.Before;
-import org.junit.Test;
-import org.opendaylight.controller.config.api.jmx.CommitStatus;
-import org.opendaylight.controller.config.manager.impl.AbstractConfigTest;
-import org.opendaylight.controller.config.manager.impl.factoriesresolver.HardcodedModuleFactoriesResolver;
-import org.opendaylight.controller.config.util.ConfigTransactionJMXClient;
-import org.opendaylight.controller.config.yang.pcep.spi.SimplePCEPExtensionProviderContextModuleFactory;
-import org.opendaylight.controller.config.yang.pcep.spi.SimplePCEPExtensionProviderContextModuleTest;
-import org.opendaylight.controller.config.yang.pcep.stateful07.cfg.SyncOptimizationsPCEPParserModuleFactory;
-
-public class SyncOptimizationsPCEPParserModuleTest extends AbstractConfigTest {
-
- private static final String FACTORY_NAME = SyncOptimizationsPCEPParserModuleFactory.NAME;
- private static final String INSTANCE_NAME = "pcep-parser-sync-optimizations-instance";
-
- @Before
- public void setUp() {
- super.initConfigTransactionManagerImpl(new HardcodedModuleFactoriesResolver(this.mockedContext, new SyncOptimizationsPCEPParserModuleFactory(), new SimplePCEPExtensionProviderContextModuleFactory()));
- }
-
- @Test
- public void testCreateBean() throws Exception {
- final CommitStatus status = createSyncOptimizationsPCEPParserModuleInstance();
- assertBeanCount(1, FACTORY_NAME);
- assertStatus(status, 2, 0, 0);
- }
-
- @Test
- public void testReusingOldInstance() throws Exception {
- createSyncOptimizationsPCEPParserModuleInstance();
- final ConfigTransactionJMXClient transaction = this.configRegistryClient.createTransaction();
- assertBeanCount(1, FACTORY_NAME);
- final CommitStatus status = transaction.commit();
- assertBeanCount(1, FACTORY_NAME);
- assertStatus(status, 0, 0, 2);
- }
-
- private CommitStatus createSyncOptimizationsPCEPParserModuleInstance() throws Exception {
- final ConfigTransactionJMXClient transaction = this.configRegistryClient.createTransaction();
- final ObjectName baseParserON = transaction.createModule(FACTORY_NAME, INSTANCE_NAME);
-
- SimplePCEPExtensionProviderContextModuleTest.createPCEPExtensionsModuleInstance(transaction, Lists.newArrayList(baseParserON));
- return transaction.commit();
- }
-}
+++ /dev/null
-/*
- * Copyright (c) 2013 Cisco Systems, 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
- */
-/**
- * Generated file
-
- * Generated from: yang module name: odl-pcep-impl-cfg yang module local name: pcep-parser-base
- * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
- * Generated at: Tue Dec 03 09:34:06 CET 2013
- *
- * Do not modify this file unless it is present under src/main directory
- */
-package org.opendaylight.controller.config.yang.pcep.impl;
-
-import org.opendaylight.protocol.pcep.parser.BaseParserExtensionActivator;
-
-/**
- *
- */
-public final class BasePCEPParserModule extends org.opendaylight.controller.config.yang.pcep.impl.AbstractBasePCEPParserModule {
-
- public BasePCEPParserModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier,
- final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
- super(identifier, dependencyResolver);
- }
-
- public BasePCEPParserModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier,
- final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, final BasePCEPParserModule oldModule,
- final java.lang.AutoCloseable oldInstance) {
-
- super(identifier, dependencyResolver, oldModule, oldInstance);
- }
-
- @Override
- public java.lang.AutoCloseable createInstance() {
- return new BaseParserExtensionActivator();
- }
-}
+++ /dev/null
-/*
- * Copyright (c) 2013 Cisco Systems, 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
- */
-/**
- * Generated file
-
- * Generated from: yang module name: odl-pcep-impl-cfg yang module local name: pcep-parser-base
- * Generated by: org.opendaylight.controller.config.yangjmxgenerator.plugin.JMXGenerator
- * Generated at: Tue Dec 03 09:34:06 CET 2013
- *
- * Do not modify this file unless it is present under src/main directory
- */
-package org.opendaylight.controller.config.yang.pcep.impl;
-
-/**
-*
-*/
-public class BasePCEPParserModuleFactory extends org.opendaylight.controller.config.yang.pcep.impl.AbstractBasePCEPParserModuleFactory {
-
-}
}
}
- identity pcep-parser-base {
- base config:module-type;
- config:provided-service spi:extension;
- config:java-name-prefix BasePCEPParser;
- }
-
- augment "/config:modules/config:module/config:configuration" {
- case pcep-parser-base {
- when "/config:modules/config:module/config:type = 'pcep-parser-base'";
- }
- }
-
identity pcep-dispatcher-impl {
base config:module-type;
config:provided-service pcep:pcep-dispatcher;
+++ /dev/null
-/*
- * Copyright (c) 2014 Cisco Systems, 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.controller.config.yang.pcep.impl;
-
-import com.google.common.collect.Lists;
-
-import javax.management.ObjectName;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.opendaylight.controller.config.api.jmx.CommitStatus;
-import org.opendaylight.controller.config.manager.impl.AbstractConfigTest;
-import org.opendaylight.controller.config.manager.impl.factoriesresolver.HardcodedModuleFactoriesResolver;
-import org.opendaylight.controller.config.util.ConfigTransactionJMXClient;
-import org.opendaylight.controller.config.yang.pcep.spi.SimplePCEPExtensionProviderContextModuleFactory;
-import org.opendaylight.controller.config.yang.pcep.spi.SimplePCEPExtensionProviderContextModuleTest;
-
-public class BasePCEPParserModuleTest extends AbstractConfigTest {
-
- private static final String FACTORY_NAME = BasePCEPParserModuleFactory.NAME;
- private static final String INSTANCE_NAME = "pcep-parser-base-instance";
-
- @Before
- public void setUp() {
- super.initConfigTransactionManagerImpl(new HardcodedModuleFactoriesResolver(mockedContext, new BasePCEPParserModuleFactory(), new SimplePCEPExtensionProviderContextModuleFactory()));
- }
-
- @Test
- public void testCreateBean() throws Exception {
- CommitStatus status = createBasePCEPParserModuleInstance();
- assertBeanCount(1, FACTORY_NAME);
- assertStatus(status, 2, 0, 0);
- }
-
- @Test
- public void testReusingOldInstance() throws Exception {
- createBasePCEPParserModuleInstance();
- ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
- assertBeanCount(1, FACTORY_NAME);
- CommitStatus status = transaction.commit();
- assertBeanCount(1, FACTORY_NAME);
- assertStatus(status, 0, 0, 2);
- }
-
- private CommitStatus createBasePCEPParserModuleInstance() throws Exception {
- final ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
- final ObjectName baseParserON = transaction.createModule(FACTORY_NAME, INSTANCE_NAME);
-
- SimplePCEPExtensionProviderContextModuleTest.createPCEPExtensionsModuleInstance(transaction, Lists.newArrayList(baseParserON));
- return transaction.commit();
- }
-}
import org.opendaylight.controller.config.yang.netty.threadgroup.NettyThreadgroupModuleMXBean;
import org.opendaylight.controller.config.yang.pcep.spi.SimplePCEPExtensionProviderContextModuleFactory;
import org.opendaylight.controller.config.yang.pcep.spi.SimplePCEPExtensionProviderContextModuleMXBean;
+import org.opendaylight.protocol.pcep.spi.PCEPExtensionProviderContext;
+import org.opendaylight.protocol.pcep.spi.pojo.SimplePCEPExtensionProviderContext;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.impl.rev130627.PathType;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.impl.rev130627.StoreType;
import org.osgi.framework.Filter;
}).when(mockedContext).createFilter(anyString());
doNothing().when(mockedContext).addServiceListener(any(ServiceListener.class), anyString());
- setupMockService(EventLoopGroup.class);
+ setupMockService(EventLoopGroup.class, mock(EventLoopGroup.class));
+ setupMockService(PCEPExtensionProviderContext.class, new SimplePCEPExtensionProviderContext());
}
- private void setupMockService(Class<?> serviceInterface) throws Exception {
- ServiceReference<?> mockServiceRef = mock(ServiceReference.class);
+ private void setupMockService(final Class<?> serviceInterface, final Object instance) throws Exception {
+ final ServiceReference<?> mockServiceRef = mock(ServiceReference.class);
doReturn(new ServiceReference[]{mockServiceRef}).when(mockedContext).
getServiceReferences(anyString(), contains(serviceInterface.getName()));
- doReturn(mock(serviceInterface)).when(mockedContext).getService(mockServiceRef);
+ doReturn(new ServiceReference[]{mockServiceRef}).when(mockedContext).
+ getServiceReferences(serviceInterface.getName(), null);
+ doReturn(instance).when(mockedContext).getService(mockServiceRef);
}
@Test
+++ /dev/null
-/*
- * Copyright (c) 2014 Cisco Systems, 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.controller.config.yang.pcep.sr.cfg;
-
-import org.opendaylight.protocol.pcep.segment.routing.SegmentRoutingActivator;
-
-public class SegmentRoutingPCEPParserModule extends org.opendaylight.controller.config.yang.pcep.sr.cfg.AbstractSegmentRoutingPCEPParserModule {
- public SegmentRoutingPCEPParserModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
- super(identifier, dependencyResolver);
- }
-
- public SegmentRoutingPCEPParserModule(org.opendaylight.controller.config.api.ModuleIdentifier identifier, org.opendaylight.controller.config.api.DependencyResolver dependencyResolver, org.opendaylight.controller.config.yang.pcep.sr.cfg.SegmentRoutingPCEPParserModule oldModule, java.lang.AutoCloseable oldInstance) {
- super(identifier, dependencyResolver, oldModule, oldInstance);
- }
-
- @Override
- public void customValidation() {
- // add custom validation form module attributes here.
- }
-
- @Override
- public java.lang.AutoCloseable createInstance() {
- return new SegmentRoutingActivator(getIanaSrSubobjectsType());
- }
-
-}
+++ /dev/null
-/*
- * Copyright (c) 2014 Cisco Systems, 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.controller.config.yang.pcep.sr.cfg;
-public class SegmentRoutingPCEPParserModuleFactory extends org.opendaylight.controller.config.yang.pcep.sr.cfg.AbstractSegmentRoutingPCEPParserModuleFactory {
-
-}
--- /dev/null
+# Copyright (c) 2016 Brocade Communications Systems, 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
+org.opendaylight.protocol.pcep.segment.routing.SegmentRoutingActivator
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+ xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0">
+
+ <odl:clustered-app-config id="segmentRoutingAppConfig"
+ binding-class="org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.pcep.segment.routing.app.config.rev160707.PcepSegmentRoutingAppConfig"/>
+
+ <bean id="segmentRoutingActivator" class="org.opendaylight.protocol.pcep.segment.routing.SegmentRoutingActivator">
+ <argument>
+ <bean factory-ref="segmentRoutingAppConfig" factory-method="isIanaSrSubobjectsType"/>
+ </argument>
+ </bean>
+
+ <service ref="segmentRoutingActivator" interface="org.opendaylight.protocol.pcep.spi.PCEPExtensionProviderActivator"
+ odl:type="org.opendaylight.protocol.pcep.segment.routing.SegmentRoutingActivator"/>
+</blueprint>
\ No newline at end of file
"Initial revision.";
}
- identity pcep-parser-segment-routing {
- base config:module-type;
- config:provided-service spi:extension;
- config:java-name-prefix SegmentRoutingPCEPParser;
- }
-
- augment "/config:modules/config:module/config:configuration" {
- case pcep-parser-segment-routing {
- when "/config:modules/config:module/config:type = 'pcep-parser-segment-routing'";
- leaf iana-sr-subobjects-type {
- description "If false (default) SR-ERO type (=5) and SR-RRO type (=6) is used,
- else proposed type (36) is used for parsing/serialization";
- type boolean;
- default false;
- }
- }
- }
-
identity pcep-segment-routing-capability {
base config:module-type;
config:java-name-prefix "PCEPSegmentRoutingCapability";
--- /dev/null
+module pcep-segment-routing-app-config {
+ yang-version 1;
+ namespace "urn:opendaylight:params:xml:ns:yang:controller:pcep:segment-routing-app-config";
+ prefix "pcep-segment-routing-app-config";
+
+ description
+ "Configuration for the PCEP segment routing extension.";
+
+ revision "2016-07-07" {
+ description
+ "Initial revision.";
+ }
+
+ container pcep-segment-routing-app-config {
+ leaf iana-sr-subobjects-type {
+ description "If false (default) SR-ERO type (=5) and SR-RRO type (=6) is used,
+ else proposed type (36) is used for parsing/serialization";
+ type boolean;
+ default false;
+ }
+ }
+}
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright (c) 2014 Cisco Systems, 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.controller.config.yang.pcep.sr.cfg;
-
-import static org.opendaylight.controller.config.yang.pcep.spi.SimplePCEPExtensionProviderContextModuleTest.createPCEPExtensionsModuleInstance;
-
-import com.google.common.collect.Lists;
-import javax.management.ObjectName;
-import org.junit.Before;
-import org.junit.Test;
-import org.opendaylight.controller.config.api.jmx.CommitStatus;
-import org.opendaylight.controller.config.manager.impl.AbstractConfigTest;
-import org.opendaylight.controller.config.manager.impl.factoriesresolver.HardcodedModuleFactoriesResolver;
-import org.opendaylight.controller.config.util.ConfigTransactionJMXClient;
-import org.opendaylight.controller.config.yang.pcep.spi.SimplePCEPExtensionProviderContextModuleFactory;
-
-public class SegmentRoutingPCEPParserModuleTest extends AbstractConfigTest {
-
- private static final String FACTORY_NAME = SegmentRoutingPCEPParserModuleFactory.NAME;
- private static final String INSTANCE_NAME = "pcep-parser-sr02-instance";
-
- @Before
- public void setUp() {
- super.initConfigTransactionManagerImpl(new HardcodedModuleFactoriesResolver(mockedContext, new SegmentRoutingPCEPParserModuleFactory(), new SimplePCEPExtensionProviderContextModuleFactory()));
- }
-
- @Test
- public void testCreateBean() throws Exception {
- final CommitStatus status = createSrPCEPParserModuleInstance();
- assertBeanCount(1, FACTORY_NAME);
- assertStatus(status, 2, 0, 0);
- }
-
- @Test
- public void testReusingOldInstance() throws Exception {
- createSrPCEPParserModuleInstance();
- final ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
- assertBeanCount(1, FACTORY_NAME);
- final CommitStatus status = transaction.commit();
- assertBeanCount(1, FACTORY_NAME);
- assertStatus(status, 0, 0, 2);
- }
-
- private CommitStatus createSrPCEPParserModuleInstance() throws Exception {
- final ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
- final ObjectName srParserON = transaction.createModule(FACTORY_NAME, INSTANCE_NAME);
-
- createPCEPExtensionsModuleInstance(transaction, Lists.newArrayList(srParserON));
- return transaction.commit();
- }
-}
+++ /dev/null
-/*
- * Copyright (c) 2016 Cisco Systems, 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.controller.config.yang.pcep.spi;
-
-import java.util.List;
-import org.opendaylight.protocol.pcep.spi.EROSubobjectParser;
-import org.opendaylight.protocol.pcep.spi.EROSubobjectRegistry;
-import org.opendaylight.protocol.pcep.spi.EROSubobjectSerializer;
-import org.opendaylight.protocol.pcep.spi.LabelParser;
-import org.opendaylight.protocol.pcep.spi.LabelRegistry;
-import org.opendaylight.protocol.pcep.spi.LabelSerializer;
-import org.opendaylight.protocol.pcep.spi.MessageParser;
-import org.opendaylight.protocol.pcep.spi.MessageRegistry;
-import org.opendaylight.protocol.pcep.spi.MessageSerializer;
-import org.opendaylight.protocol.pcep.spi.ObjectParser;
-import org.opendaylight.protocol.pcep.spi.ObjectRegistry;
-import org.opendaylight.protocol.pcep.spi.ObjectSerializer;
-import org.opendaylight.protocol.pcep.spi.PCEPExtensionProviderActivator;
-import org.opendaylight.protocol.pcep.spi.PCEPExtensionProviderContext;
-import org.opendaylight.protocol.pcep.spi.RROSubobjectParser;
-import org.opendaylight.protocol.pcep.spi.RROSubobjectRegistry;
-import org.opendaylight.protocol.pcep.spi.RROSubobjectSerializer;
-import org.opendaylight.protocol.pcep.spi.TlvParser;
-import org.opendaylight.protocol.pcep.spi.TlvRegistry;
-import org.opendaylight.protocol.pcep.spi.TlvSerializer;
-import org.opendaylight.protocol.pcep.spi.VendorInformationObjectRegistry;
-import org.opendaylight.protocol.pcep.spi.VendorInformationTlvRegistry;
-import org.opendaylight.protocol.pcep.spi.XROSubobjectParser;
-import org.opendaylight.protocol.pcep.spi.XROSubobjectRegistry;
-import org.opendaylight.protocol.pcep.spi.XROSubobjectSerializer;
-import org.opendaylight.protocol.pcep.spi.pojo.SimplePCEPExtensionProviderContext;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.iana.rev130816.EnterpriseNumber;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Message;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Object;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Tlv;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.vendor.information.EnterpriseSpecificInformation;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.SubobjectType;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.label.subobject.LabelType;
-
-public class ReusablePCEPExtensionProviderContext implements AutoCloseable, PCEPExtensionProviderContext {
- private final PCEPExtensionProviderContext delegate = new SimplePCEPExtensionProviderContext();
- private List<PCEPExtensionProviderActivator> currentExtensionDependency;
-
- @Override
- public void close() {
- for (final PCEPExtensionProviderActivator e : this.currentExtensionDependency) {
- e.stop();
- }
- }
-
- public void start(final List<PCEPExtensionProviderActivator> extensionDependency) {
- for (final PCEPExtensionProviderActivator e : extensionDependency) {
- e.start(this.delegate);
- }
- this.currentExtensionDependency = extensionDependency;
- }
-
- public void reconfigure(final List<PCEPExtensionProviderActivator> extensionDependency) {
- // Shutdown old ones first
- for (final PCEPExtensionProviderActivator e : this.currentExtensionDependency) {
- if (!extensionDependency.contains(e)) {
- e.stop();
- }
- }
- // Start new ones
- for (final PCEPExtensionProviderActivator e : extensionDependency) {
- if (!this.currentExtensionDependency.contains(e)) {
- e.start(this.delegate);
- }
- }
- this.currentExtensionDependency = extensionDependency;
- }
-
- @Override
- public LabelRegistry getLabelHandlerRegistry() {
- return this.delegate.getLabelHandlerRegistry();
- }
-
- @Override
- public MessageRegistry getMessageHandlerRegistry() {
- return this.delegate.getMessageHandlerRegistry();
- }
-
- @Override
- public ObjectRegistry getObjectHandlerRegistry() {
- return this.delegate.getObjectHandlerRegistry();
- }
-
- @Override
- public EROSubobjectRegistry getEROSubobjectHandlerRegistry() {
- return this.delegate.getEROSubobjectHandlerRegistry();
- }
-
- @Override
- public RROSubobjectRegistry getRROSubobjectHandlerRegistry() {
- return this.delegate.getRROSubobjectHandlerRegistry();
- }
-
- @Override
- public XROSubobjectRegistry getXROSubobjectHandlerRegistry() {
- return this.delegate.getXROSubobjectHandlerRegistry();
- }
-
- @Override
- public TlvRegistry getTlvHandlerRegistry() {
- return this.delegate.getTlvHandlerRegistry();
- }
-
- @Override
- public VendorInformationTlvRegistry getVendorInformationTlvRegistry() {
- return this.delegate.getVendorInformationTlvRegistry();
- }
-
- @Override
- public VendorInformationObjectRegistry getVendorInformationObjectRegistry() {
- return this.delegate.getVendorInformationObjectRegistry();
- }
-
- @Override
- public AutoCloseable registerLabelSerializer(final Class<? extends LabelType> labelClass, final LabelSerializer serializer) {
- return this.delegate.registerLabelSerializer(labelClass, serializer);
- }
-
- @Override
- public AutoCloseable registerLabelParser(final int cType, final LabelParser parser) {
- return this.delegate.registerLabelParser(cType, parser);
- }
-
- @Override
- public AutoCloseable registerEROSubobjectParser(final int subobjectType, final EROSubobjectParser parser) {
- return this.delegate.registerEROSubobjectParser(subobjectType, parser);
- }
-
- @Override
- public AutoCloseable registerEROSubobjectSerializer(final Class<? extends SubobjectType> subobjectClass,
- final EROSubobjectSerializer serializer) {
- return this.delegate.registerEROSubobjectSerializer(subobjectClass, serializer);
- }
-
- @Override
- public AutoCloseable registerMessageParser(final int messageType, final MessageParser parser) {
- return this.delegate.registerMessageParser(messageType, parser);
- }
-
- @Override
- public AutoCloseable registerMessageSerializer(final Class<? extends Message> msgClass, final MessageSerializer serializer) {
- return this.delegate.registerMessageSerializer(msgClass, serializer);
- }
-
- @Override
- public AutoCloseable registerObjectParser(final int objectClass, final int objectType, final ObjectParser parser) {
- return this.delegate.registerObjectParser(objectClass, objectType, parser);
- }
-
- @Override
- public AutoCloseable registerObjectSerializer(final Class<? extends Object> objClass, final ObjectSerializer serializer) {
- return this.delegate.registerObjectSerializer(objClass, serializer);
- }
-
- @Override
- public AutoCloseable registerRROSubobjectParser(final int subobjectType, final RROSubobjectParser parser) {
- return this.delegate.registerRROSubobjectParser(subobjectType, parser);
- }
-
- @Override
- public AutoCloseable registerRROSubobjectSerializer(
- final Class<? extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.SubobjectType> subobjectClass,
- final RROSubobjectSerializer serializer) {
- return this.delegate.registerRROSubobjectSerializer(subobjectClass, serializer);
- }
-
- @Override
- public AutoCloseable registerTlvSerializer(final Class<? extends Tlv> tlvClass, final TlvSerializer serializer) {
- return this.delegate.registerTlvSerializer(tlvClass, serializer);
- }
-
- @Override
- public AutoCloseable registerTlvParser(final int tlvType, final TlvParser parser) {
- return this.delegate.registerTlvParser(tlvType, parser);
- }
-
- @Override
- public AutoCloseable registerVendorInformationTlvSerializer(
- final Class<? extends EnterpriseSpecificInformation> esInformationClass, final TlvSerializer serializer) {
- return this.delegate.registerVendorInformationTlvSerializer(esInformationClass, serializer);
- }
-
- @Override
- public AutoCloseable registerVendorInformationTlvParser(final EnterpriseNumber enterpriseNumber, final TlvParser parser) {
- return this.delegate.registerVendorInformationTlvParser(enterpriseNumber, parser);
- }
-
- @Override
- public AutoCloseable registerXROSubobjectSerializer(final Class<? extends SubobjectType> subobjectClass,
- final XROSubobjectSerializer serializer) {
- return this.delegate.registerXROSubobjectSerializer(subobjectClass, serializer);
- }
-
- @Override
- public AutoCloseable registerXROSubobjectParser(final int subobjectType, final XROSubobjectParser parser) {
- return this.delegate.registerXROSubobjectParser(subobjectType, parser);
- }
-
- @Override
- public AutoCloseable registerVendorInformationObjectSerializer(
- final Class<? extends EnterpriseSpecificInformation> esInformationClass, final ObjectSerializer serializer) {
- return this.delegate.registerVendorInformationObjectSerializer(esInformationClass, serializer);
- }
-
- @Override
- public AutoCloseable registerVendorInformationObjectParser(final EnterpriseNumber enterpriseNumber, final ObjectParser parser) {
- return this.delegate.registerVendorInformationObjectParser(enterpriseNumber, parser);
- }
-}
*/
package org.opendaylight.controller.config.yang.pcep.spi;
+import com.google.common.reflect.AbstractInvocationHandler;
+import com.google.common.reflect.Reflection;
+import java.lang.reflect.Method;
+import org.opendaylight.controller.config.api.osgi.WaitingServiceTracker;
+import org.opendaylight.protocol.pcep.spi.PCEPExtensionProviderContext;
+import org.osgi.framework.BundleContext;
/**
- *
+ * @deprecated Replaced by blueprint wiring
*/
-public final class SimplePCEPExtensionProviderContextModule extends
- org.opendaylight.controller.config.yang.pcep.spi.AbstractSimplePCEPExtensionProviderContextModule {
+@Deprecated
+public final class SimplePCEPExtensionProviderContextModule extends AbstractSimplePCEPExtensionProviderContextModule {
+ private BundleContext bundleContext;
public SimplePCEPExtensionProviderContextModule(final org.opendaylight.controller.config.api.ModuleIdentifier identifier,
final org.opendaylight.controller.config.api.DependencyResolver dependencyResolver) {
}
@Override
- public boolean canReuseInstance(final AbstractSimplePCEPExtensionProviderContextModule oldModule) {
- return oldModule.getInstance().getClass().equals(ReusablePCEPExtensionProviderContext.class);
+ public AutoCloseable createInstance() {
+ final WaitingServiceTracker<PCEPExtensionProviderContext> tracker =
+ WaitingServiceTracker.create(PCEPExtensionProviderContext.class, bundleContext);
+ final PCEPExtensionProviderContext service = tracker.waitForService(WaitingServiceTracker.FIVE_MINUTES);
+
+ return Reflection.newProxy(AutoCloseablePCEPExtensionProviderContext.class, new AbstractInvocationHandler() {
+ @Override
+ protected Object handleInvocation(Object proxy, Method method, Object[] args) throws Throwable {
+ if (method.getName().equals("close")) {
+ tracker.close();
+ return null;
+ } else {
+ return method.invoke(service, args);
+ }
+ }
+ });
}
- @Override
- public java.lang.AutoCloseable reuseInstance(final java.lang.AutoCloseable oldInstance) {
- final ReusablePCEPExtensionProviderContext ctx = (ReusablePCEPExtensionProviderContext) oldInstance;
- ctx.reconfigure(getExtensionDependency());
- return ctx;
+ void setBundleContext(BundleContext bundleContext) {
+ this.bundleContext = bundleContext;
}
- @Override
- public java.lang.AutoCloseable createInstance() {
- final ReusablePCEPExtensionProviderContext ctx = new ReusablePCEPExtensionProviderContext();
- ctx.start(getExtensionDependency());
- return ctx;
+ private static interface AutoCloseablePCEPExtensionProviderContext extends PCEPExtensionProviderContext, AutoCloseable {
}
}
*/
package org.opendaylight.controller.config.yang.pcep.spi;
+import org.opendaylight.controller.config.api.DependencyResolver;
+import org.osgi.framework.BundleContext;
+
/**
-*
-*/
-public class SimplePCEPExtensionProviderContextModuleFactory extends
- org.opendaylight.controller.config.yang.pcep.spi.AbstractSimplePCEPExtensionProviderContextModuleFactory {
+ * @deprecated Replaced by blueprint wiring
+ */
+@Deprecated
+public class SimplePCEPExtensionProviderContextModuleFactory extends AbstractSimplePCEPExtensionProviderContextModuleFactory {
+ @Override
+ public SimplePCEPExtensionProviderContextModule instantiateModule(String instanceName, DependencyResolver dependencyResolver,
+ SimplePCEPExtensionProviderContextModule oldModule, AutoCloseable oldInstance, BundleContext bundleContext) {
+ SimplePCEPExtensionProviderContextModule module = super.instantiateModule(instanceName, dependencyResolver, oldModule,
+ oldInstance, bundleContext);
+ module.setBundleContext(bundleContext);
+ return module;
+ }
+ @Override
+ public SimplePCEPExtensionProviderContextModule instantiateModule(String instanceName, DependencyResolver dependencyResolver,
+ BundleContext bundleContext) {
+ SimplePCEPExtensionProviderContextModule module = super.instantiateModule(instanceName, dependencyResolver, bundleContext);
+ module.setBundleContext(bundleContext);
+ return module;
+ }
}
--- /dev/null
+/*
+ * Copyright (c) 2016 Brocade Communications Systems, 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.protocol.pcep.spi.pojo;
+
+import com.google.common.base.Preconditions;
+import java.util.List;
+import org.opendaylight.protocol.pcep.spi.PCEPExtensionProviderActivator;
+import org.opendaylight.protocol.pcep.spi.PCEPExtensionProviderContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Starts and stops PCEPExtensionProviderActivator instances for a PCEPExtensionProviderContext.
+ *
+ * @author Thomas Pantelis
+ */
+public class SimplePCEPExtensionProviderContextActivator implements AutoCloseable {
+ private static final Logger LOG = LoggerFactory.getLogger(SimplePCEPExtensionProviderContextActivator.class);
+
+ private final PCEPExtensionProviderContext providerContext;
+ private final List<PCEPExtensionProviderActivator> extensionActivators;
+
+ public SimplePCEPExtensionProviderContextActivator(final PCEPExtensionProviderContext providerContext,
+ final List<PCEPExtensionProviderActivator> extensionActivators) {
+ this.providerContext = Preconditions.checkNotNull(providerContext);
+ this.extensionActivators = Preconditions.checkNotNull(extensionActivators);
+ }
+
+ public void start() {
+ LOG.debug("Starting {} PCEPExtensionProviderActivator instances", extensionActivators.size());
+
+ for(final PCEPExtensionProviderActivator e : extensionActivators) {
+ e.start(providerContext);
+ }
+ }
+
+ @Override
+ public void close() {
+ LOG.debug("Stopping {} BGPExtensionProviderActivator instances", extensionActivators.size());
+
+ for(final PCEPExtensionProviderActivator e : extensionActivators) {
+ e.stop();
+ }
+ }
+}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+ xmlns:odl="http://opendaylight.org/xmlns/blueprint/v1.0.0">
+
+ <!-- Obtains the specific list of PCEPExtensionProviderActivator OSGi services announced via
+ META-INF/services/org.opendaylight.protocol.pcep.spi.PCEPExtensionProviderActivator resources.
+ -->
+ <odl:specific-reference-list id="extensionActivators" interface="org.opendaylight.protocol.pcep.spi.PCEPExtensionProviderActivator"/>
+
+ <bean id="extensionProviderContext" class="org.opendaylight.protocol.pcep.spi.pojo.SimplePCEPExtensionProviderContext"/>
+
+ <bean id="extensionProviderContextActivator" class="org.opendaylight.protocol.pcep.spi.pojo.SimplePCEPExtensionProviderContextActivator"
+ init-method="start" destroy-method="close">
+ <argument ref="extensionProviderContext"/>
+ <argument ref="extensionActivators"/>
+ </bean>
+
+ <service ref="extensionProviderContext">
+ <interfaces>
+ <value>org.opendaylight.protocol.pcep.spi.PCEPExtensionProviderContext</value>
+ <value>org.opendaylight.protocol.pcep.spi.PCEPExtensionConsumerContext</value>
+ </interfaces>
+ </service>
+</blueprint>
\ No newline at end of file
base "config:service-type";
config:java-class "org.opendaylight.protocol.pcep.spi.PCEPExtensionProviderActivator";
+ config:disable-osgi-service-registration;
}
identity pcep-extensions-impl {
augment "/config:modules/config:module/config:configuration" {
case pcep-extensions-impl {
when "/config:modules/config:module/config:type = 'pcep-extensions-impl'";
-
- list extension {
- uses config:service-ref {
- refine type {
- mandatory true;
- config:required-identity extension;
- }
- }
- }
}
}
}
+++ /dev/null
-/*
- * Copyright (c) 2015 Cisco Systems, 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.controller.config.yang.pcep.spi;
-
-import static org.junit.Assert.assertEquals;
-import io.netty.buffer.ByteBuf;
-import io.netty.buffer.Unpooled;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.mockito.MockitoAnnotations;
-import org.opendaylight.protocol.pcep.spi.EROSubobjectParser;
-import org.opendaylight.protocol.pcep.spi.EROSubobjectSerializer;
-import org.opendaylight.protocol.pcep.spi.LabelParser;
-import org.opendaylight.protocol.pcep.spi.LabelSerializer;
-import org.opendaylight.protocol.pcep.spi.MessageParser;
-import org.opendaylight.protocol.pcep.spi.MessageSerializer;
-import org.opendaylight.protocol.pcep.spi.ObjectHeaderImpl;
-import org.opendaylight.protocol.pcep.spi.ObjectParser;
-import org.opendaylight.protocol.pcep.spi.ObjectSerializer;
-import org.opendaylight.protocol.pcep.spi.PCEPDeserializerException;
-import org.opendaylight.protocol.pcep.spi.PCEPExtensionProviderActivator;
-import org.opendaylight.protocol.pcep.spi.PCEPExtensionProviderContext;
-import org.opendaylight.protocol.pcep.spi.RROSubobjectParser;
-import org.opendaylight.protocol.pcep.spi.RROSubobjectSerializer;
-import org.opendaylight.protocol.pcep.spi.TlvParser;
-import org.opendaylight.protocol.pcep.spi.TlvSerializer;
-import org.opendaylight.protocol.pcep.spi.XROSubobjectParser;
-import org.opendaylight.protocol.pcep.spi.XROSubobjectSerializer;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.iana.rev130816.EnterpriseNumber;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev131007.Keepalive;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.message.rev131007.KeepaliveBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Message;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.ObjectHeader;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Tlv;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.exclude.route.object.xro.Subobject;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.exclude.route.object.xro.SubobjectBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.of.list.tlv.OfList;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.of.list.tlv.OfListBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.open.object.OpenBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.rp.object.Rp;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.vendor.information.EnterpriseSpecificInformation;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.vendor.information.objects.VendorInformationObject;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.vendor.information.tlvs.VendorInformationTlv;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.subobject.type.AsNumberCase;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.subobject.type.AsNumberCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.subobject.type.IpPrefixCase;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.label.subobject.LabelType;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.label.subobject.label.type.Type1LabelCase;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.label.subobject.label.type.Type1LabelCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.subobject.type.IpPrefixCaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.subobject.type.LabelCase;
-
-/**
- * Created by cgasparini on 17.6.2015.
- */
-public class ReusablePCEPExtensionProviderContextTest {
-
- List<PCEPExtensionProviderContext> AuxList = new ArrayList<>();
-
- @Mock
- XROSubobjectParser xroParser;
- @Mock
- XROSubobjectSerializer xroSerializer;
-
- @Mock
- RROSubobjectParser rroParser;
- @Mock
- RROSubobjectSerializer rroSerializer;
-
- @Mock
- EROSubobjectParser eroParser;
- @Mock
- EROSubobjectSerializer eroSerializer;
-
- @Mock
- TlvParser tlvParser;
- @Mock
- TlvSerializer tlvSerializer;
-
- @Mock
- ObjectParser objectParser;
- @Mock
- ObjectSerializer objectSerializer;
-
- @Mock
- MessageParser msgParser;
- @Mock
- MessageSerializer msgSerializer;
-
- @Mock
- LabelParser labelParser;
- @Mock
- LabelSerializer labelSerializer;
- @Mock
- VendorInformationTlv viTlv;
- @Mock
- EnterpriseSpecificInformation es;
- @Mock
- VendorInformationObject esi;
-
- @Before
- public void setUp() throws PCEPDeserializerException {
- MockitoAnnotations.initMocks(this);
-
- Mockito.doReturn(null).when(this.xroParser).parseSubobject(Mockito.any(ByteBuf.class), Mockito.anyBoolean());
- Mockito.doNothing().when(this.xroSerializer).serializeSubobject(Mockito.any(Subobject.class), Mockito.any(ByteBuf.class));
-
- Mockito.doReturn(null).when(this.rroParser).parseSubobject(Mockito.any(ByteBuf.class));
- Mockito.doNothing().when(this.rroSerializer).serializeSubobject(Mockito.any(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.reported.route.object.rro.Subobject.class), Mockito.any(ByteBuf.class));
-
- Mockito.doReturn(null).when(this.eroParser).parseSubobject(Mockito.any(ByteBuf.class), Mockito.anyBoolean());
- Mockito.doNothing().when(this.eroSerializer).serializeSubobject(Mockito.any(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.explicit.route.object.ero.Subobject.class), Mockito.any(ByteBuf.class));
-
- Mockito.doReturn(this.viTlv).when(this.tlvParser).parseTlv(Mockito.any(ByteBuf.class));
- Mockito.doNothing().when(this.tlvSerializer).serializeTlv(Mockito.any(Tlv.class), Mockito.any(ByteBuf.class));
-
- Mockito.doReturn(new OpenBuilder().build()).when(this.objectParser).parseObject(Mockito.any(ObjectHeader.class), Mockito.any(ByteBuf.class));
- Mockito.doNothing().when(this.objectSerializer).serializeObject(Mockito.any(org.opendaylight.yang.gen.v1.urn
- .opendaylight.params.xml.ns.yang.pcep.types.rev131005.Object.class), Mockito.any(ByteBuf.class));
-
- Mockito.doReturn(null).when(this.msgParser).parseMessage(Mockito.any(ByteBuf.class), Mockito.any(List.class));
- Mockito.doNothing().when(this.msgSerializer).serializeMessage(Mockito.any(Message.class), Mockito.any(ByteBuf.class));
-
- Mockito.doReturn(null).when(this.labelParser).parseLabel(Mockito.any(ByteBuf.class));
- Mockito.doNothing().when(this.labelSerializer).serializeLabel(Mockito.anyBoolean(), Mockito.anyBoolean(), Mockito.any(LabelType.class), Mockito.any(ByteBuf.class));
-
- Mockito.doReturn(this.es).when(this.esi).getEnterpriseSpecificInformation();
-
- Mockito.doReturn(EnterpriseSpecificInformation.class).when(this.es).getImplementedInterface();
-
- Mockito.doReturn(this.es).when(this.viTlv).getEnterpriseSpecificInformation();
-
- Mockito.doReturn(EnterpriseSpecificInformation.class).when(this.es).getImplementedInterface();
- }
-
- @Test
- public void testReusablePCEPExtensionProviderContext() throws PCEPDeserializerException {
- List<PCEPExtensionProviderActivator> list = new ArrayList<>();
- list.add(new simplePCEPExtensionProviderActivator());
- list.add(new simplePCEPExtensionProviderActivator());
-
-
- ReusablePCEPExtensionProviderContext ctx = new ReusablePCEPExtensionProviderContext();
- ctx.start(list);
-
- assertEquals(2, AuxList.size());
-
- final List<PCEPExtensionProviderActivator> listReconf = new ArrayList<>();
- listReconf.add(new simplePCEPExtensionProviderActivator());
- listReconf.add(new simplePCEPExtensionProviderActivator());
- listReconf.add(new simplePCEPExtensionProviderActivator());
- listReconf.add(new simplePCEPExtensionProviderActivator());
- ctx.reconfigure(listReconf);
- assertEquals(4, AuxList.size());
-
- ctx.registerLabelParser(1, this.labelParser);
- ctx.registerLabelSerializer(Type1LabelCase.class, this.labelSerializer);
-
- ctx.registerEROSubobjectParser(2, this.eroParser);
- ctx.registerEROSubobjectSerializer(IpPrefixCase.class, this.eroSerializer);
-
- ctx.registerMessageParser(6, this.msgParser);
- ctx.registerMessageSerializer(Keepalive.class, this.msgSerializer);
-
- ctx.registerObjectParser(5, 1, this.objectParser);
- ctx.registerObjectSerializer(Rp.class, this.objectSerializer);
-
- ctx.registerRROSubobjectParser(3, this.rroParser);
- ctx.registerRROSubobjectSerializer(LabelCase.class, this.rroSerializer);
-
- ctx.registerTlvParser(1, this.tlvParser);
- ctx.registerTlvSerializer(OfList.class, this.tlvSerializer);
-
- ctx.registerXROSubobjectParser(2, this.xroParser);
- ctx.registerXROSubobjectSerializer(AsNumberCase.class, this.xroSerializer);
-
- ctx.registerVendorInformationTlvSerializer(EnterpriseSpecificInformation.class, this.tlvSerializer);
- ctx.registerVendorInformationTlvParser(new EnterpriseNumber(12L), this.tlvParser);
-
- ctx.registerVendorInformationObjectParser(new EnterpriseNumber(10L), this.objectParser);
- ctx.registerVendorInformationObjectSerializer(EnterpriseSpecificInformation.class, this.objectSerializer);
-
- final ByteBuf buffer = Unpooled.buffer();
- ctx.getEROSubobjectHandlerRegistry().parseSubobject(3, buffer, true);
-
- ctx.getEROSubobjectHandlerRegistry().serializeSubobject(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.explicit.route.object.ero.
- SubobjectBuilder().setSubobjectType(new AsNumberCaseBuilder().build()).build(), buffer);
-
- ctx.getLabelHandlerRegistry().parseLabel(1, buffer);
- ctx.getLabelHandlerRegistry().serializeLabel(true, false, new Type1LabelCaseBuilder().build(), buffer);
-
- ctx.getMessageHandlerRegistry().parseMessage(6, buffer, Collections.<Message>emptyList());
- ctx.getMessageHandlerRegistry().serializeMessage(new KeepaliveBuilder().build(), buffer);
-
- ctx.getObjectHandlerRegistry().parseObject(4, 1, new ObjectHeaderImpl(true, false), buffer);
- ctx.getObjectHandlerRegistry().serializeObject(new OpenBuilder().build(), buffer);
-
- ctx.getRROSubobjectHandlerRegistry().parseSubobject(4, buffer);
- ctx.getRROSubobjectHandlerRegistry().serializeSubobject(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.reported.route.object.rro.SubobjectBuilder().setSubobjectType(new IpPrefixCaseBuilder().build()).build(), buffer);
-
- ctx.getTlvHandlerRegistry().parseTlv(2, buffer);
- ctx.getTlvHandlerRegistry().serializeTlv(new OfListBuilder().build(), buffer);
-
- ctx.getVendorInformationObjectRegistry().parseVendorInformationObject(new EnterpriseNumber(10L), new ObjectHeaderImpl(true, false), buffer);
- ctx.getVendorInformationObjectRegistry().serializeVendorInformationObject(this.esi, buffer);
-
- ctx.getVendorInformationTlvRegistry().parseVendorInformationTlv(new EnterpriseNumber(12L), buffer);
- ctx.getVendorInformationTlvRegistry().serializeVendorInformationTlv(this.viTlv, buffer);
-
- ctx.getXROSubobjectHandlerRegistry().parseSubobject(2, buffer, false);
- ctx.getXROSubobjectHandlerRegistry().serializeSubobject(new SubobjectBuilder().setSubobjectType(new AsNumberCaseBuilder().build()).build(), buffer);
-
- ctx.close();
- assertEquals(0, AuxList.size());
- }
-
- class simplePCEPExtensionProviderActivator implements PCEPExtensionProviderActivator {
- @Override
- public void start(final PCEPExtensionProviderContext context) {
- AuxList.add(context);
- }
-
- @Override
- public void stop() {
- AuxList.remove(AuxList.size() - 1);
- }
- }
-}
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright (c) 2014 Cisco Systems, 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.controller.config.yang.pcep.spi;
-
-import java.util.List;
-
-import javax.management.ObjectName;
-
-import org.junit.Before;
-import org.junit.Test;
-import org.opendaylight.controller.config.api.jmx.CommitStatus;
-import org.opendaylight.controller.config.manager.impl.AbstractConfigTest;
-import org.opendaylight.controller.config.manager.impl.factoriesresolver.HardcodedModuleFactoriesResolver;
-import org.opendaylight.controller.config.util.ConfigTransactionJMXClient;
-
-public class SimplePCEPExtensionProviderContextModuleTest extends AbstractConfigTest {
-
- private static final String FACTORY_NAME = SimplePCEPExtensionProviderContextModuleFactory.NAME;
- private static final String INSTANCE_NAME = "pcep-extensions-impl";
-
- @Before
- public void setUp() throws Exception {
- super.initConfigTransactionManagerImpl(new HardcodedModuleFactoriesResolver(mockedContext, new SimplePCEPExtensionProviderContextModuleFactory()));
- }
-
- @Test
- public void testCreateBean() throws Exception {
- CommitStatus status = createInstance();
- assertBeanCount(1, FACTORY_NAME);
- assertStatus(status, 1, 0, 0);
- }
-
- @Test
- public void testReusingOldInstance() throws Exception {
- createInstance();
- ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
- assertBeanCount(1, FACTORY_NAME);
- CommitStatus status = transaction.commit();
- assertBeanCount(1, FACTORY_NAME);
- assertStatus(status, 0, 0, 1);
- }
-
- private CommitStatus createInstance() throws Exception {
- ConfigTransactionJMXClient transaction = configRegistryClient.createTransaction();
- transaction.createModule(FACTORY_NAME, INSTANCE_NAME);
- return transaction.commit();
- }
-
- public static ObjectName createPCEPExtensionsModuleInstance(final ConfigTransactionJMXClient transaction,
- final List<ObjectName> extensions) throws Exception {
- final ObjectName objectName = transaction.createModule(FACTORY_NAME, INSTANCE_NAME);
- SimplePCEPExtensionProviderContextModuleMXBean mxBean = transaction.newMXBeanProxy(objectName,
- SimplePCEPExtensionProviderContextModuleMXBean.class);
- mxBean.setExtension(extensions);
- return objectName;
- }
-
-}
import java.util.List;
import java.util.Random;
import javax.management.ObjectName;
+import org.junit.Before;
import org.junit.Test;
import org.opendaylight.controller.config.api.ValidationException;
import org.opendaylight.controller.config.api.jmx.CommitStatus;
import org.opendaylight.controller.config.yang.pcep.spi.SimplePCEPExtensionProviderContextModuleFactory;
import org.opendaylight.controller.config.yang.pcep.stateful07.cfg.PCEPStatefulCapabilityModuleFactory;
import org.opendaylight.controller.config.yang.programming.impl.AbstractInstructionSchedulerTest;
+import org.opendaylight.protocol.pcep.spi.PCEPExtensionProviderContext;
+import org.opendaylight.protocol.pcep.spi.pojo.SimplePCEPExtensionProviderContext;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.controller.rfc2385.cfg.rev160324.Rfc2385Key;
private static final PortNumber LISTEN_PORT = new PortNumber(4189);
private static final TopologyId TOPOLOGY_ID = new TopologyId("pcep-topology");
+ @Override
+ @Before
+ public void setUp() throws Exception {
+ super.setUp();
+
+ setupMockService(PCEPExtensionProviderContext.class, new SimplePCEPExtensionProviderContext());
+ }
+
@Test
public void testValidationExceptionListenAddressNotSet() throws Exception {
try {
import static org.junit.Assert.fail;
import java.util.List;
import javax.management.ObjectName;
+import org.junit.Before;
import org.junit.Test;
import org.opendaylight.controller.config.api.ValidationException;
import org.opendaylight.controller.config.api.jmx.CommitStatus;
import org.opendaylight.controller.config.yang.pcep.topology.provider.PCEPTopologyProviderModuleTest;
import org.opendaylight.controller.config.yang.pcep.topology.provider.Stateful07TopologySessionListenerModuleFactory;
import org.opendaylight.controller.config.yang.programming.impl.AbstractInstructionSchedulerTest;
+import org.opendaylight.protocol.pcep.spi.PCEPExtensionProviderContext;
+import org.opendaylight.protocol.pcep.spi.pojo.SimplePCEPExtensionProviderContext;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TopologyId;
public class PCEPTunnelTopologyProviderModuleTest extends AbstractInstructionSchedulerTest {
private static final TopologyId TOPOLOGY_ID = new TopologyId("pcep-topology");
+ @Override
+ @Before
+ public void setUp() throws Exception {
+ super.setUp();
+
+ setupMockService(PCEPExtensionProviderContext.class, new SimplePCEPExtensionProviderContext());
+ }
+
@Test
public void testValidationExceptionTopologyIdNotSet() throws Exception {
try {
setupMockService(DOMRpcProviderService.class, mockRpcProvider);
}
- private void setupMockService(final Class<?> serviceInterface, final Object instance) throws Exception {
+ protected void setupMockService(final Class<?> serviceInterface, final Object instance) throws Exception {
final ServiceReference<?> mockServiceRef = mock(ServiceReference.class);
doReturn(new ServiceReference[]{mockServiceRef}).when(mockedContext).
getServiceReferences(anyString(), contains(serviceInterface.getName()));