Developing plugins for VPP


tianye <tianye2@...>
 

Hello Everyone:

 

When I followed the instruction in this page, I met some problem.

https://docs.fd.io/hc2vpp/1.18.07/hc2vpp-parent/release-notes-aggregator/devel_plugin_vpp_tutorial.html

I want to enable and test the “samples” plugin under the hc2vpp root directory.

My hc2vpp code base is stable/1807 branch.

In 2.1. Updating YANG models of this page, it said:

Now rebuild the *-api module.  à My understanding is to run “mvn clean install -DskipTests -Dcheckstyle.skip -Dmaven.javadoc.skip=true -Djacoco.skip” under the hc2vpp/samples/samples-api dir.

The build result is ok.

Then as “2.2. JVpp dependency” mentioned, modify those xml files.

Then “2.3. Updating the customizers” told me to “First of all, remove CrudService interface and ElementCrudService class”, but actually I can’t find “CrudService and ElementCrudService class” in hc2vpp/samples/samples-api or samples-impl dir, did it matter?

Then as “2.3.1. Changes to ElementStateCustomizer” said, modify the java code. Actually the code in stable/1807 already did the same thing. So skip this step.

Then at the last of this section, I notice this:“Now it’s time to rebuild the plugin using mvn clean install to make the jars available for integrating them with vpp-integration distribution in next sections”

I ran “mvn clean install” under both hc2vpp/samples/samples-impl and hc2vpp/samples, the result is ok.

Then “3. Integrating with vpp-integration distribution” mentioned: “add a dependency for this sample plugin in vpp-integration distribution (honeycomb/vpp-integration/minimal-distribution/pom.xml”

But, in honeycomb code base, I can not find the sub dir “vpp-integration”? (Instead, under hc2vpp, there is a sub dir “vpp-integration”)

And this section also mention “Modify vpp-integration-distribution pom.xml property <distribution.modules>”, Which is the so called “vpp-integration-distribution pom.xml”?

At last, this page said: “Now just rebuild the honeycomb project.”, rebuild honeycomb ? hc2vpp?

Besides, I modified the hc2vpp/vpp-integration/pom.xml as “3. Integrating with vpp-integration distribution”  and ““Modify vpp-integration-distribution pom.xml property <distribution.modules>” said,

when I tried to build hc2vpp, the result was fail. I also attached the build log.

Too much confusion…..

本电子邮件(包括任何的附件)为本公司保密文件。本文件仅仅可为以上指定的收件人或公司使用,如果阁下非电子邮件所指定之收件人,那么阁下对该邮件部分或全部的泄漏、阅览、复印、变更、散布或对邮件内容的使用都是被严格禁止的。如果阁下接收了该错误传送的电子邮件,敬请阁下通过回复该邮件的方式立即通知寄件人,同时删除你所接收到的文本。 This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.


Michal Cmarada <mcmarada@...>
 

Hi,

 

Maybe there are some differences in java code and the original tutorial, I will take a look and fix it if needed.

 

As of other questions, here are my comments:

 

2.1 – in this part it is needed to modify the yang model according to your needs, example shows simple VXLAN model, but later you will need to replace it with your desired model (based on function you want to configure in vpp)

If the model is ok (can be validated with pyang - https://github.com/mbj4668/pyang), then you need to build the api exactly as you stated (there might be other issues you need to address if build fails (e.g. Naming problems (not all names are acceptable for java class names))).

If the build is ok you continue with the implementation.

 

2.2 – it says that you need to add dependency for JVPP from VPP in pom.xml file in sample-impl. Example shows how to add jvpp-core, which contains most of api calls for VPP, but some plugins require more (jvpp-nat, jvpp-acl …)

 

2.3 – Probably CrudService is no longer there or was created with different tutorial, it should be ok to ignore this (I will check the documentation and fix if necessary)

 

2.3.1 – yes the code reflects yang model, only if you change something in yang model you need to update customizers. Can be skipped if no changes were made. After that you need to build the implementation and aggregator as you stated (samples-impl and samples)

 

3. – the vpp-integration is from HC2VPP code base, Maybe the naming is left from times when there was only one project (honeycomb), it was then split into two (honeycomb - which is core, and HC2VPP – which is honeycomb for VPP). The documentation was copied from original Honeycomb (again I will check it and fix).

Here you need to update hc2vpp/vpp-integration/minimal-distribution/pom.xml and add sample module to <distribution.modules> (add line io.fd.hc2vpp.samples.Module,). You also need to update dependencies and include sample-plugin-impl there.

Afterwards you need to build hc2vpp project and if the build is successful the distribution should be built in hc2vpp/vpp-integration/minimal-distribution/target/vpp-integration-distribution-1.18.07.1-SNAPSHOT-hc/vpp-integration-distribution-1.18.07.1-SNAPSHOT and you can start honeycomb with provided executables

 

BUILD BUG:

As for the bug it seems you have specified wrong version of sample module (should be 18.07.01-SNAPSHOT). Currently stable 1807 points to 18.07.01-SNAPSHOT. It is necessary to have it specified correctly in vpp-integration-distribution pom.xml file. Usually it is best to use variable for version reference:
    <dependency>

      <groupId>io.fd.hc2vpp.samples</groupId>

      <artifactId>samples-impl</artifactId>

      <version>${project.version}</version>

    </dependency>

Also please check if groupId is the same in samples-api, samples-impl and samples pom.xml files. it should be <groupId>io.fd.hc2vpp.samples</groupId>, also check the dependencies (wrong groupid may cause different order of build and different location of artifacts built in local .m2 repository). Last think to check are package names and module definition in hc2vpp/vpp-integration/minimal-distribution/pom.xml -> <distribution.modules>. The package should be the same (io.fd.hc2vpp.samples.*) in all classes.

You can also check if the artifacts appear in your local .m2 repository after you build sample-api, sample-impl and sample. By default it is located here: ~/.m2/repository/io/fd/hc2vpp/samples

If all of this match you should be able to build hc2vpp project and find your distribution in path specified in step 3.

 

NOTE:

If you want to build rpm or debian packages check scripts in hc2vpp/packaging. After successful build you should be able to create a package using hc2vpp/packaging/deb/xenial/debuild.sh or hc2vpp/packaging/rpm/rpmbuild.sh

 

Thanks for the feedback and feel free to let me know if you experience other problems.

 

Regards,

 

Michal

 

 

Michal Cmarada

Engineer - Software

mcmarada@...

Tel:

 

 

 

 

Cisco Systems, Inc.

 

 

 

Slovakia

cisco.com

Think before you print.

This email may contain confidential and privileged material for the sole use of the intended recipient. Any review, use, distribution or disclosure by others is strictly prohibited. If you are not the intended recipient (or authorized to receive for the recipient), please contact the sender by reply email and delete all copies of this message.

Please click here for Company Registration Information.

 

 

From: hc2vpp@... <hc2vpp@...> On Behalf Of tianye
Sent: Thursday, October 25, 2018 12:55 PM
To: hc2vpp@...
Subject: [hc2vpp] Developing plugins for VPP

 

Hello Everyone:

 

When I followed the instruction in this page, I met some problem.

https://docs.fd.io/hc2vpp/1.18.07/hc2vpp-parent/release-notes-aggregator/devel_plugin_vpp_tutorial.html

I want to enable and test the “samples” plugin under the hc2vpp root directory.

My hc2vpp code base is stable/1807 branch.

In 2.1. Updating YANG models of this page, it said:

Now rebuild the *-api module.  à My understanding is to run “mvn clean install -DskipTests -Dcheckstyle.skip -Dmaven.javadoc.skip=true -Djacoco.skip” under the hc2vpp/samples/samples-api dir.

The build result is ok.

Then as “2.2. JVpp dependency” mentioned, modify those xml files.

Then “2.3. Updating the customizers” told me to “First of all, remove CrudService interface and ElementCrudService class”, but actually I can’t find “CrudService and ElementCrudService class” in hc2vpp/samples/samples-api or samples-impl dir, did it matter?

Then as “2.3.1. Changes to ElementStateCustomizer” said, modify the java code. Actually the code in stable/1807 already did the same thing. So skip this step.

Then at the last of this section, I notice this:“Now it’s time to rebuild the plugin using mvn clean install to make the jars available for integrating them with vpp-integration distribution in next sections”

I ran “mvn clean install” under both hc2vpp/samples/samples-impl and hc2vpp/samples, the result is ok.

Then “3. Integrating with vpp-integration distribution” mentioned: “add a dependency for this sample plugin in vpp-integration distribution (honeycomb/vpp-integration/minimal-distribution/pom.xml”

But, in honeycomb code base, I can not find the sub dir “vpp-integration”? (Instead, under hc2vpp, there is a sub dir “vpp-integration”)

And this section also mention “Modify vpp-integration-distribution pom.xml property <distribution.modules>”, Which is the so called “vpp-integration-distribution pom.xml”?

At last, this page said: “Now just rebuild the honeycomb project.”, rebuild honeycomb ? hc2vpp?

Besides, I modified the hc2vpp/vpp-integration/pom.xml as “3. Integrating with vpp-integration distribution”  and ““Modify vpp-integration-distribution pom.xml property <distribution.modules>” said,

when I tried to build hc2vpp, the result was fail. I also attached the build log.

Too much confusion…..

电子邮件(包括任何的附件)为本公司保密文件。本文件仅仅可为以上指定的收件人或公司使用,如果阁下非电子邮件所指定之收件人,那么阁下对该邮件部分或全部的泄漏、阅览、复印、变更、散布或对邮件内容的使用都是被严格禁止的。如果阁下接收了该错误传送的电子邮件,敬请阁下通过回复该邮件的方式立即通知寄件人,同时删除你所接收到的文本。 This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.