Skip to content

Instantly share code, notes, and snippets.

@tudang tudang/pop_all.txt
Created Jun 27, 2016

Embed
What would you like to do?
"Semantic error: Error when calling primitive pop (my_table -> untag -> pop) line 20: argument 1 has type field, but formal count has type integer value"
// Metadata to count number of labels
header_type ingress_metadata_t {
fields {
count : 32;
}
}
// Count number of labels in the stack
parser parse_label {
extract(label_stack[next]);
set_metadata(ingress_metadata.count, (ingress_metadata.count + 1));
return select(latest.bos) {
0 : parse_label;
1 : ingress;
}
}
// Remove all labels
action untag() {
pop(label_stack, ingress_metadata.count);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.