@Test
 public void testSetInterfaceDescription() throws ProtocolException, ResourceException {
   IIPCapability ipCapability =
       (IIPCapability)
           routerResource.getCapability(
               InitializerTestHelper.getCapabilityInformation(TestsConstants.IP_CAPABILITY_TYPE));
   ipCapability.setInterfaceDescription(ParamCreationHelper.getLogicalPort());
   IQueueManagerCapability queueCapability =
       (IQueueManagerCapability)
           routerResource.getCapability(
               InitializerTestHelper.getCapabilityInformation(
                   TestsConstants.QUEUE_CAPABILIY_TYPE));
   QueueResponse queueResponse = (QueueResponse) queueCapability.execute();
   Assert.assertTrue(queueResponse.isOk());
 }
 @Test
 /** Test to check if capability is available from OSGi. */
 public void isCapabilityAccessibleFromResource() throws ResourceException, ProtocolException {
   startResource();
   Assert.assertFalse(routerResource.getCapabilities().isEmpty());
   Assert.assertNotNull(
       routerResource.getCapability(
           InitializerTestHelper.getCapabilityInformation(TestsConstants.QUEUE_CAPABILIY_TYPE)));
   Assert.assertNotNull(
       routerResource.getCapability(
           InitializerTestHelper.getCapabilityInformation(
               TestsConstants.STATIC_ROUTE_CAPABILITY_TYPE)));
   stopResource();
   Assert.assertTrue(resourceManager.listResources().isEmpty());
 }
  @Before
  public void initBundles() throws ResourceException, ProtocolException {

    InitializerTestHelper.removeResources(resourceManager);
    log.info("INFO: Initialized!");
    startResource();
  }
  public void startResource() throws ResourceException, ProtocolException {
    /* initialize model */
    List<CapabilityDescriptor> lCapabilityDescriptors = new ArrayList<CapabilityDescriptor>();

    CapabilityDescriptor ipCapabilityDescriptor =
        ResourceHelper.newCapabilityDescriptor(
            TestsConstants.ACTION_NAME,
            TestsConstants.CAPABILIY_VERSION,
            TestsConstants.IP_CAPABILITY_TYPE,
            TestsConstants.CAPABILITY_URI);
    lCapabilityDescriptors.add(ipCapabilityDescriptor);

    // Add Queue Capability Descriptor
    CapabilityDescriptor queueCapabilityDescriptor = ResourceHelper.newQueueCapabilityDescriptor();
    lCapabilityDescriptors.add(queueCapabilityDescriptor);
    // Router Resource Descriptor
    ResourceDescriptor resourceDescriptor =
        ResourceHelper.newResourceDescriptor(
            lCapabilityDescriptors,
            TestsConstants.RESOURCE_TYPE,
            TestsConstants.RESOURCE_URI,
            RESOURCE_INFO_NAME);

    routerResource = resourceManager.createResource(resourceDescriptor);

    // If not exists the protocol session manager, it's created and add the session context
    InitializerTestHelper.addSessionContext(
        protocolManager,
        routerResource.getResourceIdentifier().getId(),
        TestsConstants.RESOURCE_URI);

    // Start resource
    resourceManager.startResource(routerResource.getResourceIdentifier());
  }
  /** Test to check create static route method */
  @Test
  public void createStaticRouteTest() throws ProtocolException, ResourceException {
    startResource();

    StaticRouteCapability staticRouteCapability =
        (StaticRouteCapability)
            routerResource.getCapability(
                InitializerTestHelper.getCapabilityInformation(
                    TestsConstants.STATIC_ROUTE_CAPABILITY_TYPE));
    staticRouteCapability.createStaticRoute("0.0.0.0", "0.0.0.0", "192.168.1.1");

    IQueueManagerCapability queueCapability =
        (IQueueManagerCapability)
            routerResource.getCapability(
                InitializerTestHelper.getCapabilityInformation(
                    TestsConstants.QUEUE_CAPABILIY_TYPE));
    QueueResponse queueResponse = (QueueResponse) queueCapability.execute();
    Assert.assertTrue(queueResponse.isOk());

    stopResource();
  }
 @After
 public void stopBundle() throws Exception {
   InitializerTestHelper.removeResources(resourceManager);
   log.info("INFO: Stopped!");
 }