Пример #1
0
 def do_addflow(self, arg, forced=False):
     """
     addflow [bridge] flow
     Add a flow to a bridge.
     """
     args = arg.replace('"', '').replace("'", "").split()
     if len(args) < 2:
         output('Not enough parameters are given, use like ')
         output('br-int addflow priority=3 ip actions=OUTPUT:1\n')
         return
     bridge, flow_str = args[0], ' '.join(args[1:])
     if not br_exists(bridge):
         if self.bridge:
             bridge, flow_str = self.bridge, ' '.join(args)
         else:
             output('Please give a valid bridge.\n')
             return
     flow = fmt_flow_str(flow_str)
     if not flow:
         output('Please give a valid flow.\n')
         return
     if not br_addflow(bridge, flow):
         output('Add flow <%s> to %s failed.\n' % (flow, bridge))
     else:
         output('Add flow <%s> to %s done.\n' % (flow, bridge))
Пример #2
0
 def do_addflow(self, arg, forced=False):
     """
     addflow [bridge] flow
     Add a flow to a bridge.
     """
     args = arg.replace('"', '').replace("'", "").split()
     if len(args) < 2:
         output('Not enough parameters are given, use like ')
         output('br-int addflow priority=3 ip actions=OUTPUT:1\n')
         return
     bridge, flow_str = args[0], ' '.join(args[1:])
     if not br_exists(bridge):
         if self.bridge:
             bridge, flow_str = self.bridge, ' '.join(args)
         else:
             output('Please give a valid bridge.\n')
             return
     flow = fmt_flow_str(flow_str)
     if not flow:
         output('Please give a valid flow.\n')
         return
     if not br_addflow(bridge, flow):
         output('Add flow <%s> to %s failed.\n' % (flow, bridge))
     else:
         output('Add flow <%s> to %s done.\n' % (flow, bridge))
Пример #3
0
 def do_addflow(self, arg):
     """
     addflow [bridge] flow
     Add a flow to a bridge.
     """
     args = arg.replace('"', "").replace("'", "").split()
     bridge, flow_str = args[0], " ".join(args[1:])
     if not br_exists(bridge) and self.bridge:
         bridge, flow_str = self.bridge, " ".join(args)
     else:
         output("Please give a valid bridge.\n")
         return
     flow = fmt_flow_str(flow_str)
     if not flow:
         output("Please give a valid flow.\n")
         return
     if not br_addflow(bridge, flow):
         output("Add flow <%s> to %s failed.\n" % (flow, bridge))
     else:
         output("Add flow <%s> to %s done.\n" % (flow, bridge))
Пример #4
0
 def do_addflow(self, arg):
     """
     addflow [bridge] flow
     Add a flow to a bridge.
     """
     args = arg.replace('"', '').replace("'", "").split()
     bridge, flow_str = args[0], ' '.join(args[1:])
     if not br_exists(bridge) and self.bridge:
         bridge, flow_str = self.bridge, ' '.join(args)
     else:
         output('Please give a valid bridge.\n')
         return
     flow = fmt_flow_str(flow_str)
     if not flow:
         output('Please give a valid flow.\n')
         return
     if not br_addflow(bridge, flow):
         output('Add flow <%s> to %s failed.\n' % (flow, bridge))
     else:
         output('Add flow <%s> to %s done.\n' % (flow, bridge))