拓扑图
|-----|--------P2
vlan 2 P1-----| dut |--------P3 vlan 3
|-----|--------P4
测试步骤
1.创建vlan2 并加入端口P1.
2.创建vlan3 并加入端口P2,P3,P4.
3.创建IPMC ENTRY, sip=src ip, multicast ip=dst ip
4.配置P2 P3 P4 为vlan 3 的 IPMC egress 端口
5.创建vlan 3 对应的L3 interface 和IPMC replication entry
6.enable IPMC. 向P1 口发送sip=src ip, dip=mcast, dmac= int vlan3 的MAC地址
期望结果
P2 P3 P4 能够收到组播报文。
src_ip = 192.168.1.11
dst_ip = 224.0.1.2
src_mac = 00:00:01:00:00:02
dst_mac = 01:00:5E:00:01:02
router_mac = 00:00:01:00:00:01
ipmc_index = 0x1
1,2 省略
3 创建组播组 bcm_multicast_create(unit, BCM_MULTICAST_TYPE_L3, &new_group)
初始化IPMC结构体并加入到IPMC ENTRY
bcm_ipmc_addr_t ipmc_addr
ipmc_addr.v 0x1
.ts 0x0
.vid 2
.port_tgid 1
.flags 0
.s_ip_addr src_mac
.mc_ip_addr dst_mac
.group new_group
bcm_ipmc_add(unit, &ipmc_addr)
4. for (port = P2 to P4) {
bcm_ipmc_egress_port_set(unit, port, src_mac, 0, 3, ttl)
}
5. bcm_l3_intf_t intf_vlan3
intf_vlan3.l3a_mac_addr router_mac
.l3a_vid 3
bcm_l3_intf_create(unit,intf_vlan3)
得到intf_id = intf_vlan3.l3a_intf_id
配置replication entry
for(port = P2 to P4) {
bcm_multicast_egress_add(unit, new_group, port, intf_id)
}
6. bcm_ipmc_enable (true) 向P1 口发送
da = dst_mac
sa = src_mac
vid = 2
src ip = src_ip
dst ip = dst_ip
的IP 报文。