def test_add_flow(self):
    ofport = '99'
    vid = 4000
    lsw_id = 18
    utils.execute(['ovs-ofctl', 'add-flow', self.BR_NAME, 'hard_timeout=0,idle_timeout=0,priority=2,dl_src=ca:fe:de:ad:be:ef,actions=strip_vlan,output:0'], root_helper=self.root_helper)
    utils.execute(['ovs-ofctl', 'add-flow', self.BR_NAME, 'hard_timeout=0,idle_timeout=0,priority=1,actions=normal'], root_helper=self.root_helper)
    utils.execute(['ovs-ofctl', 'add-flow', self.BR_NAME, 'hard_timeout=0,idle_timeout=0,priority=2,actions=drop'], root_helper=self.root_helper)
    utils.execute(['ovs-ofctl', 'add-flow', self.BR_NAME, ('hard_timeout=0,idle_timeout=0,priority=2,in_port=%s,actions=drop' % ofport)], root_helper=self.root_helper)
    utils.execute(['ovs-ofctl', 'add-flow', self.BR_NAME, ('hard_timeout=0,idle_timeout=0,priority=4,in_port=%s,dl_vlan=%s,actions=strip_vlan,set_tunnel:%s,normal' % (ofport, vid, lsw_id))], root_helper=self.root_helper)
    utils.execute(['ovs-ofctl', 'add-flow', self.BR_NAME, ('hard_timeout=0,idle_timeout=0,priority=3,tun_id=%s,actions=mod_vlan_vid:%s,output:%s' % (lsw_id, vid, ofport))], root_helper=self.root_helper)
    self.mox.ReplayAll()
    self.br.add_flow(priority=2, dl_src='ca:fe:de:ad:be:ef', actions='strip_vlan,output:0')
    self.br.add_flow(priority=1, actions='normal')
    self.br.add_flow(priority=2, actions='drop')
    self.br.add_flow(priority=2, in_port=ofport, actions='drop')
    self.br.add_flow(priority=4, in_port=ofport, dl_vlan=vid, actions=('strip_vlan,set_tunnel:%s,normal' % lsw_id))
    self.br.add_flow(priority=3, tun_id=lsw_id, actions=('mod_vlan_vid:%s,output:%s' % (vid, ofport)))
    self.mox.VerifyAll()
def test_add_flow(self):
    ofport = '99'
    vid = 4000
    lsw_id = 18
    utils.execute(['ovs-ofctl', 'add-flow', self.BR_NAME, 'hard_timeout=0,idle_timeout=0,priority=2,dl_src=ca:fe:de:ad:be:ef,actions=strip_vlan,output:0'], root_helper=self.root_helper)
    utils.execute(['ovs-ofctl', 'add-flow', self.BR_NAME, 'hard_timeout=0,idle_timeout=0,priority=1,actions=normal'], root_helper=self.root_helper)
    utils.execute(['ovs-ofctl', 'add-flow', self.BR_NAME, 'hard_timeout=0,idle_timeout=0,priority=2,actions=drop'], root_helper=self.root_helper)
    utils.execute(['ovs-ofctl', 'add-flow', self.BR_NAME, ('hard_timeout=0,idle_timeout=0,priority=2,in_port=%s,actions=drop' % ofport)], root_helper=self.root_helper)
    utils.execute(['ovs-ofctl', 'add-flow', self.BR_NAME, ('hard_timeout=0,idle_timeout=0,priority=4,in_port=%s,dl_vlan=%s,actions=strip_vlan,set_tunnel:%s,normal' % (ofport, vid, lsw_id))], root_helper=self.root_helper)
    utils.execute(['ovs-ofctl', 'add-flow', self.BR_NAME, ('hard_timeout=0,idle_timeout=0,priority=3,tun_id=%s,actions=mod_vlan_vid:%s,output:%s' % (lsw_id, vid, ofport))], root_helper=self.root_helper)
    self.mox.ReplayAll()
    self.br.add_flow(priority=2, dl_src='ca:fe:de:ad:be:ef', actions='strip_vlan,output:0')
    self.br.add_flow(priority=1, actions='normal')
    self.br.add_flow(priority=2, actions='drop')
    self.br.add_flow(priority=2, in_port=ofport, actions='drop')
    self.br.add_flow(priority=4, in_port=ofport, dl_vlan=vid, actions=('strip_vlan,set_tunnel:%s,normal' % lsw_id))
    self.br.add_flow(priority=3, tun_id=lsw_id, actions=('mod_vlan_vid:%s,output:%s' % (vid, ofport)))
    self.mox.VerifyAll()