Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Properly setting up P4D2_2017 with native installation of required software #39

Closed
rmiguelc opened this issue Jun 8, 2017 · 4 comments

Comments

@rmiguelc
Copy link

rmiguelc commented Jun 8, 2017

Since P4D2_2017 seemed to provide an environment to run P4-16 programs, I've been trying the examples in P4D2_2017 with native installation of the required software, but I can't get the solutions to run.

P4 switch s1 did not start correctly.Check the switch log file.

The log file reads:

Unknown primitive action: assign

My own code ran well (sort of, see below) until I modified a (previously empty) TopIngress like this:

control TopIngress(inout Parsed_packet p, inout Metadata m,
    inout standard_metadata_t standard_metadata) {

 apply {
   standard_metadata.egress_spec = 3 - standard_metadata.ingress_port;
 }

}

I previously encountered problems running my program when using varbits (see the end of this message) and subparsers (in this case, it complained about unknown primitive assign_header).

I've tried replacing the code with a table that matches on the ingress_port and sets the egress_port since that approach is closer to P4-14, but it still yields the same error.

The error logged with varbits was:

simple_switch: P4Objects.cpp:449: int bm::P4Objects::init_objects(std::istream*, bm::LookupStructureFactory*, int, size_t, std::shared_ptrbm::TransportIface, const std::set<std::pair<std::__cxx11::basic_string, std::__cxx11::basic_string > >&, const bm::P4Objects::ForceArith&): Assertion `cfg_header_type.isMember("length_exp")' failed.
Calling target program-options parser

@rmiguelc
Copy link
Author

rmiguelc commented Jun 9, 2017

For anyone else having the same problem.

So because the logs indicated lack of primitives that obviously do exist in simple_switch, I checked the target being used. I edited the following line in p4apprunner.py:

switch_args.append('--behavioral-exe "%s"' % 'simple_switch')

to

switch_args.append('--behavioral-exe "%s"' % '~/behavioral-model/targets/simple_switch/simple_switch')

Meaning, I made it point to my local copy of bmv2. The first line appears at several places and you'll have to change it everywhere if you plan to use all Mininet topologies. The same has to be done for the compiler, obviously. Line 118 becomes:

rv = run_command('~/p4c/build/p4c-bm2-ss %s' % ' '.join(compiler_args))

I had already updated the compiler directory, but I forgot about this (now fairly obvious) issue.

@rmiguelc rmiguelc changed the title Unsupported primitives? Properly setting up P4D2_2017 with native installation of required software Jun 9, 2017
@jafingerhut
Copy link
Collaborator

jafingerhut commented Jun 9, 2017 via email

@rmiguelc
Copy link
Author

rmiguelc commented Jun 12, 2017

@jafingerhut I usually keep non-essential executables in my workspace and I was unaware I had placed a simple_switch binary elsewhere on my Ubuntu folders, hence the problem. Anyway, thanks for the tip! :)

@antoninbas
Copy link
Member

The VM image came with a pre-installed version of simple_switch, installed under /usr/local/bin. If you want to use the image with the latest version of bmv2, the correct solution is indeed to build it and re-install it, as @jafingerhut suggested. You can also install it to a local directory and update your PATH accordingly, but I don't think that's worth the trouble.

All the software that was shipped inside the VM image should be compatible. The only case where you would experience an issue IMO is if you try to update one component (e.g. p4c), without updating the rest (e.g. bmv2). That's probably what you did here.

Durbek-Gafur pushed a commit to Durbek-Gafur/P4-VCC that referenced this issue Sep 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants