有多个P4文件时,应该如何在commands.txt里设置entry?
例如,有多个p4文件,simple_router.p4 l2_switch.p4 openflow.p4,如何在
openflow.p4有table
table ofpat_dec_nw_ttl_ipv6 {
reads {
openflow_metadata.index : ternary;
openflow_metadata.group_id : ternary;
egress_egress_port : ternary;
}
actions {
ofpat_dec_nw_ttl_ipv6;
nop;
}
}
l2_switch.p4有table
table mcast_src_pruning {}
reads {
standard_metadata.instance_type : exact;
}
actions {_nop; _drop;}
size : 1;
commands.txt里直接使用mcast_src_pruning会报错:
RuntimeCmd: Error: Invalid table name (mcast_src_pruning )
该如何定义
table_set_default
table_add
6 个回复
Cool - SDN&P4程序猿
赞同来自: Wasdns
可以这样配置
table_set_default l2_switch.mcast_src_pruning _drop
l2_switch是运行的实例名称
Wasdns
赞同来自:
您是在使用如
table_set_default mcast_src_pruning [your_instance_type]
这样形式的命令情况下发生错误的吗?顺便请教一下您和冷老师@Cool ,在流表进行ternary匹配的时候,怎么样写流规则呢?
Cool - SDN&P4程序猿
赞同来自:
@Wasdns 您好,我是这样理解的
Entry:
match_type是ternary,流规则中match_fields 则填写想要匹配的多个mask,匹配动作根据field与mask的结果进行match
Wasdns
赞同来自:
是的,我想问的具体是这样的,比如我现在有一张IPv4的forwarding table,假设如下:
那么现在想要加一条流表项,比如
10.0.0.1 => 10.0.0.2
的表项,之前的想法是这样下发的:table_add ipv4_forward ipv4_forward 10.0.0.2 mask 32 => 2
当然我验证了一下上述的命令是会报错的。
Cool - SDN&P4程序猿
赞同来自:
看脚本里写的,应该是这种格式的0&&&0
if t == "ternary":
self.values[f] = "0&&&0"
试试,这样对不对?
table_add ipv4_forward ipv4_forward 10.0.0.2&&&10.0.0.2 => 2
顺便问下,table和action名字一样不报错吧?
Wasdns
赞同来自:
@Cool 好的 我试一下
在14里面是不报错的 在16里面报错