Skip to content

Conversation

@vishvesh
Copy link
Contributor

@vishvesh vishvesh commented Aug 25, 2016

This PR adds support for Tacker - NFV Orchestration - Version 1.0 Implementation

Please review and merge the initial API Implementation for Tacker - NFV Orchestration..
Links to the Docs:

Below are the Commit Descriptions:

  • Tacker - Initial API Definition..
    • Added initial Tacker API Definitions..
  • Tacker - Added Tacker Builders and Interfaces..
    • Added Tacker Builders and Interfaces for the following:
    • VNF Catalog
    • VNF Manager
    • VIM Management
  • Tacker - Added API Implementation and Domain Classes..
    • Completed Tacker Domain and Internal class implementation
    • TODO: VIM - Update API is pending, everything else is implemented and Tested..
  • Tacker - Added binding in DefaultAPIProvider..
    • Added binding in DefaultAPIProvider class..
  • Tacker - Exposed Tacker Service APIs via OSClient & OSClientSession..
    • Tacker Services are now exposed via OSClient and OSClientSession..
  • Note:
    • VIM Update API is yet to be implemented..
    • I have not added any Test Cases for the same, but I have tested and written tests on my Client.. I am not sure if the contributions are accepted only with Test validations?
    • Also note that Tacker APIs are still under development and not yet part of the Official Documentation.. So they might change in the future.. Since we are using it already, I thought of contributing so someone interested can use and enhance them..
    • I have created an Issue to Track Tacker Related Implementation issues : Support for Tacker - NFV Orchestration - Version 1.0 Implementation #786

Below are the API Usages:

  • Tacker VNFD API:
/** VNFD List */
List<? extends Vnfd> vnfds = os.tacker().vnfd().list();

/** VNFD Get by ID */
Vnfd vnfd = os.tacker().vnfd().get(v.getId());

/** VNFD Create */
VnfdAttributes attributes = VnfdAttributes.create().vnfd(vnfdTemplate);
VnfdServiceTypes serviceTypes = VnfdServiceTypes.create().serviceType("vnfd");
List<VnfdServiceTypes> serviceTypesList = Lists.newArrayList(serviceTypes);
Vnfd vnfd = Builders.tacker().vnfd()
    .name("Vnfd-Test")
    .description("VNFD-Test-Description")
    .infrastructureDriver("heat")
    .managementDriver("noop")
    .attributes(attributes)
    .serviceTypes(serviceTypesList)
    .build();
Vnfd newVnfd = os.tacker().vnfd().create(vnfd);

/** VNFD Delete */
ActionResponse res = os.tacker().vnfd().delete(newVnfd.getId());
  • Tacker VNF API:
/** VNF List */
List<? extends Vnf> vnfs = os.tacker().vnf().list();

/** VNF Get by ID */
Vnf vnf = os.tacker().vnf().get(v.getId());

/** VNF Create */
Vnf vnf = Builders.tacker().vnf()
        .name("VNF-Test")
        .description("VNF-Test-Description")
        .vnfdId("0f6b23aa-d27e-4104-821f-2f62c4bf4f91")
        .build();
Vnf newVnf = os.tacker().vnf().create(vnf);

/** VNF Update */
/** Before Updating, Poll for the VNF Status to be TackerVnfStatus.ACTIVE and then Execute the following:*/
String vnfUpdateConfig = "vdus:\n  vdu1:\n    id: vdu1\n    vm_image: cirros-0.3.4-x86_64-uec\n    instance_type: m1.tiny\n\n    network_interfaces:\n      management:\n        network: net_mgmt\n        management: true\n      pkt_in:\n        network: net0\n      pkt_out:\n        network: net1\n\n    placement_policy:\n      availability_zone: nova\n\n    auto-scaling: noop\n\n";
VnfUpdateAttributes vnfUpdateAttributes = VnfUpdateAttributes.create().config(vnfUpdateConfig);
VnfUpdate vnfUpdate = Builders.tacker().vnfUpdate().attributes(vnfUpdateAttributes).build();
Vnf updatedVnf = os.tacker().vnf().update(pollVnf.getId(), vnfUpdate);

/** VNF Delete */
ActionResponse res = os.tacker().vnf().delete(updatedVnf.getId())
  • Tacker VIM API:
/** VIM List */
List<? extends Vim> vims = os.tacker().vim().list();

/** VIM Show by ID */
Vnfd vim = os.tacker().vim().show(v.getId());

/** VIM Register */
VimProject vimProject = VimProject.create().name("admin").projectDomainName("default");
AuthCredentials authCredentials = AuthCredentials.create()
        .username("admin")
        .password("password")
        .userDomainName("default");
Vim vim = Builders.tacker().vim()
        .name("VIM-Test")
        .description("VIM-Test-Description")
        .authUrl("http://OpenStack-IP:35357/v3")
        .isDefault(Boolean.FALSE)
        .type("openstack")
        .vimProject(vimProject)
        .authCredentials(authCredentials)
        .build();
vim = os.tacker().vim().register(vim);

/** VIM Delete */
ActionResponse res = os.tacker().vim().delete(vim.getId());

vdeshmukh added 5 commits August 25, 2016 15:07
* Added initial `Tacker API` Definitions..
* Added `Tacker Builders` and `Interfaces` for the following:
 * `VNF Catalog`
 * `VNF Manager`
 * `VIM Management`
* Completed `Tacker Domain and Internal` class implementation
* TODO: `VIM - Update` API is pending, everything else is implemented
and Tested..
* Added `binding` in `DefaultAPIProvider` class..
* `Tacker` Services are now exposed via `OSClient` and
`OSClientSession`..
@vishvesh vishvesh changed the title Tacker - NFV Orchestration - Version 1.0 Implementation Support for Tacker - NFV Orchestration - Version 1.0 Implementation Aug 26, 2016
@vinodborole
Copy link
Contributor

@vishvesh good stuff. LGTM

@gondor @auhlig

@auhlig
Copy link
Member

auhlig commented Sep 1, 2016

Wow. Many thanks @vishvesh .
I'll take some time tomorrow to review.

@auhlig
Copy link
Member

auhlig commented Sep 3, 2016

@vishvesh Could you add some tests?

Besides that. Looks very good.

@gondor
Copy link
Member

gondor commented Sep 3, 2016

@vishvesh Really, really good stuff! I agree with @auhlig . Could we get some tests for this.

@vishvesh
Copy link
Contributor Author

vishvesh commented Sep 3, 2016

@gondor @auhlig @vinodborole : Thanks! I will try to write and contribute tests once I am free.. I have tested and using all these functions in my Application, and having no troubles so far.

Will this be merged, or should I add more commits to this PR with tests?

@auhlig
Copy link
Member

auhlig commented Sep 3, 2016

As this PR is introducing so much new stuff I'd be happy to have some basic tests here before merging.

@vishvesh
Copy link
Contributor Author

vishvesh commented Sep 3, 2016

@auhlig : Agreed 👍 Will take some time to write tests once I am free..

@auhlig
Copy link
Member

auhlig commented Sep 3, 2016

Feel free to reach out in case you need help :)

@vishvesh
Copy link
Contributor Author

vishvesh commented Sep 3, 2016

@auhlig : Ohh that would be awesome 👍 I'll try to add some tests by next weekend..

@vishvesh
Copy link
Contributor Author

vishvesh commented Sep 7, 2016

@auhlig @vinodborole @gondor , am I missing some configuration for executing Tests?

I have added Tacker in Service Enum in AbstractTest class..

protected enum Service {
    IDENTITY(5000), 
    NETWORK(9696), 
    COMPUTE(8774), 
    BLOCK_STORAGE(8776), 
    METERING(8087), 
    TELEMETRY(8087), 
    SHARE(8786), 
    OBJECT_STORAGE(8800),
    CLUSTERING(8778),
    TACKER(9890)
    ;

My Test class looks like this:

@Test(suiteName = "tacker/vnfd")
public class TackerVnfdTests extends AbstractTest {

    private static final String TACKER_VNFDS = "/tacker/v1/vnfds.json";

    @Override
    protected Service service() {
        return Service.TACKER;
    }

    @Test
    public void testListVnfds() throws Exception {
        OSFactory.enableHttpLoggingFilter(true); //will remove this later
        respondWith(TACKER_VNFDS);
        List<? extends Vnfd> vnfds = osv3().tacker().vnfd().list();
        assertEquals(1, vnfds.size());
        Preconditions.checkNotNull(vnfds.get(0));
        Logger.getLogger(getClass().getName())
                .info(getClass().getName() + " : Tacker VNFD from List : " + vnfds.get(0));
        assertEquals(vnfds.get(0).getName(), "test-vnfd");
    }
}

I am running mvn clean install on openstack4j-core-tests for building, and same maven command on openstack4j-connectors to execute the test cases.. Is this the right way? I don't remember executing tests in such a way for Firewall Service Tests..

When Tacker Test class executes, I get the following error:

testListVnfds(org.openstack4j.api.tacker.v1.TackerVnfdTests)  Time elapsed: 1.056 sec  <<< FAILURE!
org.openstack4j.api.exceptions.ConnectionException: java.net.ConnectException: Connection refused: connect

Failed tests: 
  TackerVnfdTests.testListVnfds:34 » Connection java.net.ConnectException: Conne...

Tests run: 343, Failures: 1, Errors: 0, Skipped: 1

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO] 
[INFO] OpenStack4j Connectors ............................. SUCCESS [  0.843 s]
[INFO] OpenStack4j Jersey2 Connector ...................... FAILURE [ 14.948 s]
[INFO] OpenStack4j RestEasy Connector ..................... SKIPPED

@auhlig
Copy link
Member

auhlig commented Sep 7, 2016

You're on the right track.

Maybe the json could not be found? Or the port is already in use?

Could you check if the mockwebserver starts? https://github.com/ContainX/openstack4j/blob/master/core-test/src/main/java/org/openstack4j/api/AbstractTest.java#L73-L88

@vishvesh
Copy link
Contributor Author

vishvesh commented Sep 7, 2016

@auhlig : Figured it out..

I was missing the Catalog - Endpoints entry in the authv3_project.json..

{
  "endpoints": [
    {
      "region_id": "RegionOne",
      "url": "http://127.0.0.1:9890",
      "region": "RegionOne",
      "interface": "admin",
      "id": "0c2f6e9ed7bd499ba445103cb91e80da"
    },
    {
      "region_id": "RegionOne",
      "url": "http://127.0.0.1:9890",
      "region": "RegionOne",
      "interface": "public",
      "id": "5328f25a0e584ba392fa5cac3e9b6ee6"
    },
    {
      "region_id": "RegionOne",
      "url": "http://127.0.0.1:9890",
      "region": "RegionOne",
      "interface": "internal",
      "id": "c1f3e92aa5284fd999a113502ba4052d"
    }
  ],
  "type": "nfv-orchestration",
  "id": "83dd97cc45b7417886ad4940189b2b86",
  "name": "tacker"
 }

Tests passing now.. Will commit once it's complete.. 👍 Thanks..

@auhlig
Copy link
Member

auhlig commented Sep 7, 2016

Ah. Right.

BTW: Running either mvn clean test for tests in core-test module or mvn clean verify including integration tests (if you added some) in project root should the trick.

@vishvesh
Copy link
Contributor Author

vishvesh commented Sep 7, 2016

Doesn't work for me :( I am doing mvn clean test on openstack4j-connectors..

@auhlig
Copy link
Member

auhlig commented Sep 8, 2016

Maybe it fails, because the java version of the connectors are different. Some req. Java 7, some Java 8. Take a look at https://github.com/ContainX/openstack4j/blob/master/.travis.yml#L23-L24. See skipped modules in line 8.

@vishvesh
Copy link
Contributor Author

vishvesh commented Sep 9, 2016

That's fine, I am able to run tests via openstack4j-connectors..

@gondor
Copy link
Member

gondor commented Sep 12, 2016

@vishvesh let us know when your ready for final review. Also we'll need branch conflicts resolved

@vishvesh
Copy link
Contributor Author

@gondor : Sure, will try to find time this week, and let you know..

Regarding the conflicts, it doesn't show me what's conflicting since I do not have write access to the repository..

@auhlig
Copy link
Member

auhlig commented Sep 14, 2016

@vishvesh You don't need write access to the repo. You could do it the other way around and merge the latest into your branch.

@vishvesh
Copy link
Contributor Author

@auhlig : Okay.. 👍

vdeshmukh added 6 commits September 14, 2016 16:30
ContainX-master

Conflicts:
	core/src/main/java/org/openstack4j/api/Apis.java
	core/src/main/java/org/openstack4j/api/types/ServiceType.java
	core/src/main/java/org/openstack4j/openstack/provider/DefaultAPIProvider.java
* Updated `Builders` class to incorporate `tacker()` service builders..
* Updated `authv3_project.json` to reflect `Tacker Endpoint`..
* Added `CRUD` Tests for `Tacker Vnfd`..
* `Tacker Vnf` and `Tacker Vim` tests to be implemented..
* Implemented and tested `Tacker Vim` `CRUD` Tests..
* Removed `HttpLoggingFilter` from `TackerVnfdTests`..
* Added `Tacker Vnf - CRUD` Tests..
* All `Tacker Tests` are now complete (Except for `Vim Update`)..
@vishvesh
Copy link
Contributor Author

@gondor @auhlig :

Merge conflicts resolved 👍
All Tacker Tests are now complete 👍

Please review and merge this PR..

@vinodborole
Copy link
Contributor

LGTM @gondor @auhlig your take please

@auhlig
Copy link
Member

auhlig commented Sep 15, 2016

Very nice @vishvesh. 👍

@auhlig
Copy link
Member

auhlig commented Sep 15, 2016

I'm hesitating to merge since https://travis-ci.org/ContainX/openstack4j/builds/159561585 failed. What are we going to do about it? @vinodborole @gondor

@gondor
Copy link
Member

gondor commented Sep 15, 2016

@auhlig looking at the files on this one it looks like the underlying import that was missing in the previously failure was added to this one. Travis is saying this PR is passing so I think we're good to merge

@auhlig
Copy link
Member

auhlig commented Sep 15, 2016

Hi Jeremy, Right. Sounds good. Merging now.

@auhlig auhlig merged commit 6c3451d into ContainX:master Sep 15, 2016
@vishvesh
Copy link
Contributor Author

@gondor @vinodborole @auhlig : Awesome.. Thanks 👍

@gondor gondor added this to the 3.0.3 Release milestone Sep 17, 2016
@auhlig
Copy link
Member

auhlig commented Oct 26, 2016

Hey @vishvesh,
Just wondered if we have some kind of documentation for the this service in os4j? Else could you add some for our website https://github.com/containx/openstack4j.com. It's just markdown.
Would be much appreciated.
The issue is ContainX/openstack4j.com#18

@vishvesh
Copy link
Contributor Author

@auhlig : Alright 👍 I will contribute the Documentation for Os4j Website. Although, I am not sure about the timeline for my contribution for the mark-down..

Tacker Documentation mentioned here:

Will try to make it similar to this:

@auhlig
Copy link
Member

auhlig commented Oct 26, 2016

That would be awesome @vishvesh. Many thanks in advance. Is it okay if I assign you to this issue?
Feel free to reach out to me in case you need help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants