p4rule.py 495 Bytes
Newer Older
1
class P4Rule():
2
  def __init__(self, table, action, mparams, aparams, default=False):
David Hancock's avatar
David Hancock committed
3 4 5 6
    self.table = table
    self.action = action
    self.mparams = mparams
    self.aparams = aparams
7
    self.default = default
8
  def __str__(self):
9 10 11 12
    ret = self.table 
    if self.default:
      ret += '*'
    ret += ' ' + self.action + ' '
13 14 15 16 17 18
    for mparam in self.mparams:
      ret += str(mparam) + ' '
    ret += '=> '
    for aparam in self.aparams:
      ret += str(aparam) + ' '
    return ret[0:-1]