[P4-dev] Error on building soft switch with openflow agent

Tanja Ulmen tanja.ulmen at rwth-aachen.de
Fri Nov 11 10:20:10 EST 2016


Thanks, this did not solve the problem, but we fixed it now.

The problem was, that the old compiler p4c-behavioral was still 
installed and the package loader took the p4c-bm from there, because it 
was listed first. This p4c-bm has no __main__. After deleting the old 
one, it correctly loaded the new one with the __main__.

It seems like *load_entry_point('p4c-bm===1.3.0-d9f088b8', 
'console_scripts', 'p4c-bmv2')()* first checks if the version number is 
available, but then the first one is loaded, which in my case was the 
old one, not the new one.

Regards,
Tanja

Am 10.11.2016 um 17:43 schrieb Antonin Bas:
> Not sure I know how to help you here. You should not be seeing this is 
> you install p4c-bm with "sudo python setup.py install".
> You may try to remove the Python package manually and reinstalling it:
> - cd <p4c-bm clone>
> - sudo rm -rf /usr/local/lib/python2.7/dist-packages/p4c-bm*
> - sudo rm /usr/local/bin/p4c-bmv2
> - sudo python setup.py install
>
> On Thu, Nov 10, 2016 at 3:56 AM, Tanja Ulmen 
> <tanja.ulmen at rwth-aachen.de <mailto:tanja.ulmen at rwth-aachen.de>> wrote:
>
>     Hi,
>
>     thanks that's right, I did not run it.
>     But unfortunately it is still not running. Now the make in the
>     switch shows some error in the p4c-bmv2, that I cannot resolve:
>
>     make  all-recursive
>     make[1]: Entering directory '/home/tanja/Desktop/switch'
>     Making all in p4-build
>     make[2]: Entering directory '/home/tanja/Desktop/switch/p4-build'
>     make  all-recursive
>     make[3]: Entering directory '/home/tanja/Desktop/switch/p4-build'
>     Making all in bmv2
>     make[4]: Entering directory '/home/tanja/Desktop/switch/p4-build/bmv2'
>     PYTHONPATH=$PYTHONPATH:/usr/local/lib/python2.7/dist-packages
>     /usr/local/bin/p4c-bmv2 --pd ./switch/ --p4-prefix dc --plugin of
>     --openflow-mapping-dir /home/tanja/Desktop/switch/openflow_mapping
>     --openflow-mapping-mod l2 -DOPENFLOW_ENABLE --json ./switch.json
>     /home/tanja/Desktop/switch/p4src/switch.p4
>     Traceback (most recent call last):
>       File "/usr/local/bin/p4c-bmv2", line 9, in <module>
>         load_entry_point('p4c-bm===1.3.0-d9f088b8', 'console_scripts',
>     'p4c-bmv2')()
>       File
>     "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line
>     542, in load_entry_point
>         return get_distribution(dist).load_entry_point(group, name)
>       File
>     "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line
>     2569, in load_entry_point
>         return ep.load()
>       File
>     "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line
>     2229, in load
>         return self.resolve()
>       File
>     "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line
>     2235, in resolve
>         module = __import__(self.module_name, fromlist=['__name__'],
>     level=0)
>     ImportError: No module named __main__
>     Makefile:1273: recipe for target 'pd_files.ts' failed
>     make[4]: *** [pd_files.ts] Error 1
>     make[4]: Leaving directory '/home/tanja/Desktop/switch/p4-build/bmv2'
>     Makefile:426: recipe for target 'all-recursive' failed
>     make[3]: *** [all-recursive] Error 1
>     make[3]: Leaving directory '/home/tanja/Desktop/switch/p4-build'
>     Makefile:356: recipe for target 'all' failed
>     make[2]: *** [all] Error 2
>     make[2]: Leaving directory '/home/tanja/Desktop/switch/p4-build'
>     Makefile:469: recipe for target 'all-recursive' failed
>     make[1]: *** [all-recursive] Error 1
>     make[1]: Leaving directory '/home/tanja/Desktop/switch'
>     Makefile:393: recipe for target 'all' failed
>     make: *** [all] Error 2
>
>     Regards,
>     Tanja
>
>
>
>
>     Am 09.11.2016 um 19:52 schrieb Antonin Bas:
>>     Hi Tanja,
>>
>>     My guess is you did not run "git submodule update --init" in the
>>     switch repository after cloning it, which would lead to the
>>     p4-build component being missing. If you run this git command and
>>     run autogen.sh + configure, it should work.
>>
>>     Thanks,
>>
>>     Antonin
>>
>>     On Wed, Nov 9, 2016 at 2:22 AM, Tanja Ulmen
>>     <tanja.ulmen at rwth-aachen.de <mailto:tanja.ulmen at rwth-aachen.de>>
>>     wrote:
>>
>>         Hi Antonin,
>>
>>         thank you for your reply. Everything works fine until I try
>>         to configure the switch.
>>
>>         The "./configure --with-bmv2 --with-of" ends with this:
>>
>>         === configuring in p4-build (/home/tanja/Desktop/switch/p4-build)
>>         configure: WARNING: no configuration information is in p4-build
>>
>>         switch features recap ......................
>>         Coverage enabled .............. : no
>>         With switchlink ............... : no
>>         With switchsai ................ : no
>>         With switchapi ................ : yes
>>         With openflow ................. : yes
>>         Compile for p4factory ......... : no
>>         Compile for bmv2 .............. : yes
>>         PTF found ..................... : yes
>>
>>         thus the "make" does not work:
>>
>>         make  all-recursive
>>         make[1]: Entering directory '/home/tanja/Desktop/switch'
>>         Making all in p4-build
>>         make[2]: Entering directory '/home/tanja/Desktop/switch/p4-build'
>>         make[2]: *** No rule to make target 'all'.  Stop.
>>         make[2]: Leaving directory '/home/tanja/Desktop/switch/p4-build'
>>         Makefile:469: recipe for target 'all-recursive' failed
>>         make[1]: *** [all-recursive] Error 1
>>         make[1]: Leaving directory '/home/tanja/Desktop/switch'
>>         Makefile:393: recipe for target 'all' failed
>>         make: *** [all] Error 2
>>
>>         Where is my mistake?
>>
>>         Regards,
>>         Tanja
>>
>>
>>
>>         Am 08.11.2016 um 18:31 schrieb Antonin Bas:
>>>         Hi Tanja,
>>>
>>>         Now that switch.p4 is leveraging the P4 "range" match type,
>>>         it can no longer be compiled for bmv1 (p4c-behavioral), and
>>>         we should be removing bmv1 from p4lang very soon.
>>>         The "range" match type is supported by the new version of
>>>         the behavioral-model, aka bmv2
>>>         (https://github.com/p4lang/behavioral-model
>>>         <https://github.com/p4lang/behavioral-model>). You should be
>>>         able to compile switch.p4 with OF support for bmv2 (outside
>>>         of p4factory). Unfortunately, I did not find step-by-step
>>>         instructions, but is should basically be as follows:
>>>         - install bmv2 (https://github.com/p4lang/behavioral-model
>>>         <https://github.com/p4lang/behavioral-model>). The configure
>>>         script needs to be run with --with-pdfixed.
>>>         - install the bmv2 compiler
>>>         (https://github.com/p4lang/p4c-bm/tree/master/p4c_bm/
>>>         <https://github.com/p4lang/p4c-bm/tree/master/p4c_bm/>)
>>>         - install the OF agent (https://github.com/p4lang/p4ofagent
>>>         <https://github.com/p4lang/p4ofagent>). You need to export
>>>         CPPFLAGS=-D_BMV2_ when doing this.
>>>         - compile switch (https://github.com/p4lang/switch
>>>         <https://github.com/p4lang/switch>). You need to run
>>>         configure with --with-bmv2 and --with-of. If you are missing
>>>         any dependency, you should get an error at this point.
>>>         If you run into an issue for one of these steps, please
>>>         reach out to us.
>>>
>>>         Thanks,
>>>
>>>         Antonin
>>>
>>>         On Tue, Nov 8, 2016 at 4:57 AM, Tanja Ulmen
>>>         <tanja.ulmen at rwth-aachen.de
>>>         <mailto:tanja.ulmen at rwth-aachen.de>> wrote:
>>>
>>>             Hello everyone,
>>>
>>>             I get an error on building the Soft Switch from the
>>>             p4factory with an Openflow agent. When I run "make
>>>             bm-p4ofagent PLUGIN_OPENFLOW=1" I get the following error:
>>>
>>>             ...
>>>             Header type security_metadata_t not byte-aligned, adding
>>>             padding
>>>             Header type fabric_metadata_t not byte-aligned, adding
>>>             padding
>>>             Header type int_metadata_i2e_t not byte-aligned, adding
>>>             padding
>>>             Header type meter_metadata_t not byte-aligned, adding
>>>             padding
>>>             Header type qos_metadata_t not byte-aligned, adding padding
>>>             Generating files in directory
>>>             /home/tanja/Desktop/test/p4factory/targets/switch/build/bm
>>>             total phv length (in bytes): 2020
>>>             P4_MATCH_RANGE match not yet supported
>>>             Traceback (most recent call last):
>>>               File
>>>             "/home/tanja/Desktop/test/p4factory/submodules/p4c-behavioral/p4c_bm/shell.py",
>>>             line 150, in <module>
>>>                 main()
>>>               File
>>>             "/home/tanja/Desktop/test/p4factory/submodules/p4c-behavioral/p4c_bm/shell.py",
>>>             line 138, in main
>>>                 dump_yaml = args.dump_yaml)
>>>               File
>>>             "/home/tanja/Desktop/test/p4factory/submodules/p4c-behavioral/p4c_bm/smart.py",
>>>             line 1164, in render_dict_create
>>>             render_dict_populate_tables(render_dict, hlir)
>>>               File
>>>             "/home/tanja/Desktop/test/p4factory/submodules/p4c-behavioral/p4c_bm/smart.py",
>>>             line 661, in render_dict_populate_tables
>>>                 assert(False)
>>>             AssertionError
>>>             /home/tanja/Desktop/test/p4factory/submodules/p4c-behavioral/p4c-bm.mk:96
>>>             <http://p4c-bm.mk:96>: recipe for target
>>>             'bm_tenjin_output_oldest' failed
>>>             make: *** [bm_tenjin_output_oldest] Error 1
>>>
>>>             Does anyone know, how to solve it? I use the p4factory
>>>             repository as it is, without any changes.
>>>
>>>             Regards,
>>>             Tanja
>>>
>>>             _______________________________________________
>>>             P4-dev mailing list
>>>             P4-dev at lists.p4.org <mailto:P4-dev at lists.p4.org>
>>>             http://lists.p4.org/mailman/listinfo/p4-dev_lists.p4.org
>>>             <http://lists.p4.org/mailman/listinfo/p4-dev_lists.p4.org>
>>>
>>>
>>>
>>>
>>>         -- 
>>>         Antonin
>>
>>
>>         _______________________________________________
>>         P4-dev mailing list
>>         P4-dev at lists.p4.org <mailto:P4-dev at lists.p4.org>
>>         http://lists.p4.org/mailman/listinfo/p4-dev_lists.p4.org
>>         <http://lists.p4.org/mailman/listinfo/p4-dev_lists.p4.org>
>>
>>
>>
>>
>>     -- 
>>     Antonin
>
>
>
>
> -- 
> Antonin

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.p4.org/pipermail/p4-dev_lists.p4.org/attachments/20161111/069b0b71/attachment-0002.html>


More information about the P4-dev mailing list