Beispiel #1
0
    def _xml_change_appset_list(self, xml):
        if None == self.should.get('appset_list'):
            self['appset_list'] = []

        (adds, dels) = Resource.diff_list(
            self.has.get('appset_list', []), self.should['appset_list'])

        for this in adds:
            xml.append(E('application-set', E.name(this)))
        for this in dels:
            xml.append(E('application-set', JXML.DEL, E.name(this)))
        return True
Beispiel #2
0
    def _xml__change__hit(self, xml, prop, ele_name):
        (adds, dels) = Resource.diff_list(self.has[prop], self.should[prop])
        if not adds and not dels:
            return False

        hit = E('host-inbound-traffic')
        for this in adds:
            hit.append(E(ele_name, E.name(this)))
        for this in dels:
            hit.append(E(ele_name, JXML.DEL, E.name(this)))
        xml.append(hit)
        return True
Beispiel #3
0
    def _xml_change_match_srcs(self, xml):
        adds, dels = Resource.diff_list(
            self.has['match_srcs'], self.should['match_srcs'])

        if len(adds):
            x_match = E.match()
            xml.append(x_match)
            for this in adds:
                x_match.append(E('source-address', E.name(this)))

        if len(dels):
            x_match = E.match()
            xml.append(x_match)
            for this in dels:
                x_match.append(E('source-address', JXML.DEL, E.name(this)))

        return True