def save(self): cmds = [] cmds.append("services sp auto-config interface rules add \"%s\"" % self.name) cmds.append("services sp auto-config interface rules edit \"%s\" description set \"%s\"" % (self.name, self.description)) cmds.append("services sp auto-config interface rules edit \"%s\" precedence set %s" % (self.name, self.precedence)) if self.action_type: cmds.append("services sp auto-config interface rules edit \"%s\" action type enable" % self.name) cmds.append("services sp auto-config interface rules edit \"%s\" type set %s" % (self.name, self.action_set_type)) else: cmds.append("services sp auto-config interface rules edit \"%s\" action type disable" % self.name) if self.action_asns: cmds.append("services sp auto-config interface rules edit \"%s\" action asns enable" % self.name) cmds.append("services sp auto-config interface rules edit \"%s\" peers set %s" % (self.name, self.action_set_asn)) else: cmds.append("services sp auto-config interface rules edit \"%s\" action asns disable" % self.name) if self.action_set_mo: cmds.append("services sp auto-config interface rules edit \"%s\" action managed_objects enable" % self.name) cmds.append("services sp auto-config interface rules edit \"%s\" managed_objects type set %s" % (self.name, self.action_set_mo_type)) for mo in self.action_set_mos: cmds.append("services sp auto-config interface rules edit \"%s\" managed_objects add \"%s\"" % (self.name, mo)) else: cmds.append("services sp auto-config interface rules edit \"%s\" managed_objects clear" % self.name) cmds.append("services sp auto-config interface rules edit \"%s\" regexp set \"%s\"" % (self.name, self.match_intf_desc_regex)) pf = PeakflowSOAP(self.co) for cmd in cmds: res = pf.cliRun(cmd) return res
def from_peakflow(cls, co): """ """ pf = PeakflowSOAP(co) config = pf.cliRun("config show") mos = cls.from_conf(config["results"]) for mo in mos: mo.co = co return mos
def from_peakflow(cls, co): """ """ pf = PeakflowSOAP(co) config = pf.cliRun("config show") mos = cls.from_conf(config['results']) for mo in mos: mo.co = co return mos
def save(self): # TODO: implement support for parents.. cmds = [] cmds.append('services sp managed_objects add "%s"' % self.name) for tag in self.tags: cmds.append('services sp managed_objects edit "%s" tags add "%s"' % (self.name, tag)) cmds.append('services sp managed_objects edit "%s" description set "%s"' % (self.name, self.description)) cmds.append('services sp managed_objects edit "%s" family set "%s"' % (self.name, self.family)) cmds.append('services sp managed_objects edit "%s" match set %s' % (self.name, self.match.get_conf())) pf = PeakflowSOAP(self.co) for cmd in cmds: res = pf.cliRun(cmd) return res
def save(self): # TODO: implement support for parents.. cmds = [] cmds.append("services sp managed_objects add \"%s\"" % self.name) for tag in self.tags: cmds.append( "services sp managed_objects edit \"%s\" tags add \"%s\"" % (self.name, tag)) cmds.append( "services sp managed_objects edit \"%s\" description set \"%s\"" % (self.name, self.description)) cmds.append( "services sp managed_objects edit \"%s\" family set \"%s\"" % (self.name, self.family)) cmds.append("services sp managed_objects edit \"%s\" match set %s" % (self.name, self.match.get_conf())) pf = PeakflowSOAP(self.co) for cmd in cmds: res = pf.cliRun(cmd) return res