Exemplo n.º 1
0
    def __init__(self, access_list_name: str, sequence_number: int):
        super().__init__()
        self.__ipv4_acl_and_prefix_list = Element('ipv4-acl-and-prefix-list')
        self.__accesses = SubElement(
            self.__ipv4_acl_and_prefix_list, 'accesses')
        self.__access = SubElement(self.__accesses, 'access')

        if is_not_none(access_list_name):
            access_list_name_ = SubElement(self.__access, 'access-list-name')
            access_list_name_.text = access_list_name
        else:
            raise NoneException()

        self.__access_list_entries = SubElement(
            self.self.__access, 'access-list-entries')
        self.__access_list_entry = SubElement(
            self.__access_list_entries, 'access-list-entry')

        if is_not_none(sequence_number):
            sequence_number_ = SubElement('sequence-number')
            sequence_number_.text = sequence_number
        else:
            raise NoneException()
Exemplo n.º 2
0
    def ipv6(self,
             destination: str,
             source: str = None,
             timeout: int = None,
             probe: int = None,
             numeric: bool = None,
             vrf_name: str = None,
             min_ttl: int = None,
             max_ttl: int = None,
             port: int = None,
             verbose: bool = None,
             priority: int = None,
             outgoing_interface: str = None):
        """
            destination: str. Destination address or hostname.

            source: str. Source address or interface.

            timeout: int. range "0..36". Timeout in seconds.

            probe: int. range "1..64". Probe count.

            numeric: bool. Numeric display only.

            vrf_name: str. VRF name.

            min_ttl: int. range "0..255". minimum time to live.

            max_ttl: int. range "0..255". maximum time to live.

            port: int. range "0..65535". Port numbe.

            verbose: bool. verbose output.

            priority: int. range "0..15". Priority of hte packet.

            outgoing_interface: str. Outgoing interface, needed in case of traceroute to link local address.
        """

        ipv6_ = SubElement(self, 'traceroute-act:ipv6')

        if is_not_none(destination):
            destination_ = SubElement(ipv6_, 'traceroute-act:destination')
            destination_.text = destination
        else:
            raise NoneException('destination cannot be None')

        if is_not_none(source):
            source_ = SubElement(ipv6_, 'traceroute-act:source')
            source_.text = source

        if is_not_none(timeout):
            timeout_ = SubElement(ipv6_, 'traceroute-act:timeout')
            timeout_.text = convert_to_string(timeout)

        if is_not_none(probe):
            probe_ = SubElement(ipv6_, 'traceroute-act:probe')
            probe_.text = convert_to_string(probe)

        if is_not_none(numeric):
            numeric_ = SubElement(ipv6_, 'traceroute-act:numeric')
            numeric_.text = convert_to_string(numeric)

        if is_not_none(vrf_name):
            vrf_name_ = SubElement(ipv6_, 'traceroute-act:vrf-name')
            vrf_name_.text = vrf_name_

        if is_not_none(min_ttl):
            min_ttl_ = SubElement(ipv6_, 'traceroute-act:min-ttl')
            min_ttl_.text = convert_to_string(min_ttl)

        if is_not_none(max_ttl):
            max_ttl_ = SubElement(ipv6_, 'traceroute-act:max-ttl')
            max_ttl_.text = convert_to_string(max_ttl)

        if is_not_none(port):
            port_ = SubElement(ipv6_, 'traceroute-act:port')
            port_.text = convert_to_string(port)

        if is_not_none(verbose):
            verbose_ = SubElement(ipv6_, 'traceroute-act:verbose')
            verbose_.text = convert_to_string(verbose)

        if is_not_none(priority):
            priority_ = SubElement(ipv6_, 'traceroute-act:priority')
            priority_.text = convert_to_string(priority)

        if is_not_none(outgoing_interface):
            outgoing_interface_ = SubElement(
                ipv6_, 'traceroute-act:outgoing-interface')
            outgoing_interface_.text = outgoing_interface
Exemplo n.º 3
0
    def ipv6(self,
             destination: str,
             repeat_count: int = None,
             data_size: int = None,
             timeout: int = None,
             interval: int = None,
             pattern: int = None,
             sweep: bool = None,
             vrf_name: str = None,
             source: str = None,
             verbose: bool = None,
             priority: int = None,
             outgoing_interface: str = None):
        """
           destination: str. Ping destination address or hostname.

           repeat_count: int. range "1..64". Number of ping packets to be sent out.

           data_size: int. range "36..18024". Size of ping packet.

           timeout: int. range "0..36". Timeout in seconds.

           interval: int. range "0..3600". Ping interval in milli seconds.

           pattern: int. Pattern of payload data.

           sweep: bool. Sweep is enabled.

           vrf_name: str. VRF name.

           source: str. Source address or interface.

           verbose: bool. Validate return packet.

           priority: int. range "0..15". Priority of the packet.

           outgoing_interface: str. Outgoing interface, needed in case of ping to link local address.

        """
        ipv6_ = SubElement(self, 'ping-act:ipv6')

        if is_not_none(destination):
            destination_ = SubElement(ipv6_, 'ping-act:destination')
            destination_.text = destination
        else:
            raise NoneException('destination cannot be None.')

        if is_not_none(repeat_count):
            repeat_count_ = SubElement(ipv6_, 'ping-act:repeat-count')
            repeat_count_.text = convert_to_string(repeat_count)

        if is_not_none(data_size):
            data_size_ = SubElement(ipv6_, 'ping-act:data-size')
            data_size_.text = convert_to_string(data_size)

        if is_not_none(timeout):
            timeout_ = SubElement(ipv6_, 'ping-act:timeout')
            timeout_.text = convert_to_string(timeout)

        if is_not_none(interval):
            interval_ = SubElement(ipv6_, 'ping-act:interval')
            interval_.text = convert_to_string(interval)

        if is_not_none(pattern):
            pattern_ = SubElement(ipv6_, 'ping-act:pattern')
            pattern_.text = convert_to_string(pattern)

        if is_not_none(sweep):
            sweep_ = SubElement(ipv6_, 'ping-act:sweep')
            sweep_.text = convert_to_string(sweep)

        if is_not_none(vrf_name):
            vrf_name_ = SubElement(ipv6_, 'ping-act:vrf-name')
            vrf_name_.text = vrf_name

        if is_not_none(source):
            source_ = SubElement(ipv6_, 'ping-act:source')
            source_.text = source

        if is_not_none(verbose):
            verbose_ = SubElement(ipv6_, 'ping-act:verbose')
            verbose_.text = convert_to_string(verbose)

        if is_not_none(priority):
            priority_ = SubElement(ipv6_, 'ping-act:priority')
            priority_.text = convert_to_string(priority)

        if is_not_none(outgoing_interface):
            outgoing_interface_ = SubElement(ipv6_,
                                             'ping-act:outgoing-interface')
            outgoing_interface_.text = outgoing_interface
Exemplo n.º 4
0
    def ipv4(
        self,
        destination: str,
        repeat_count: int = None,
        data_size: int = None,
        timeout: int = None,
        interval: int = None,
        pattern: int = None,
        sweep: bool = None,
        vrf_name: str = None,
        source: str = None,
        verbose: bool = None,
        type_of_service: int = None,
        do_not_frag: bool = None,
        validate: bool = None,
    ):
        """
           destination: str. Ping destination address or hostname.

           repeat_count: int. range "1..64". Number of ping packets to be sent out.

           data_size: int. range "36..18024". Size of ping packet.

           timeout: int. range "0..36". Timeout in seconds.

           interval: int. range "0..3600". Ping interval in milli seconds.

           pattern: int. Pattern of payload data.

           sweep: bool. Sweep is enabled.

           vrf_name: str. VRF name.

           source: str. Source address or interface.

           verbose: bool. Validate return packet.

           type_of_service: int. range "0..255. Type of Service.

           do_not_frag: bool. Do Not Fragment.

           validate: bool. Validate return packet.

        """
        ipv4_ = SubElement(self, 'ping-act:ipv4')

        if is_not_none(destination):
            destination_ = SubElement(ipv4_, 'ping-act:destination')
            destination_.text = destination
        else:
            raise NoneException('destination cannot be None.')

        if is_not_none(repeat_count):
            repeat_count_ = SubElement(ipv4_, 'ping-act:repeat-count')
            repeat_count_.text = convert_to_string(repeat_count)

        if is_not_none(data_size):
            data_size_ = SubElement(ipv4_, 'ping-act:data-size')
            data_size_.text = convert_to_string(data_size)

        if is_not_none(timeout):
            timeout_ = SubElement(ipv4_, 'ping-act:timeout')
            timeout_.text = convert_to_string(timeout)

        if is_not_none(interval):
            interval_ = SubElement(ipv4_, 'ping-act:interval')
            interval_.text = convert_to_string(interval)

        if is_not_none(pattern):
            pattern_ = SubElement(ipv4_, 'ping-act:pattern')
            pattern_.text = convert_to_string(pattern)

        if is_not_none(sweep):
            sweep_ = SubElement(ipv4_, 'ping-act:sweep')
            sweep_.text = convert_to_string(sweep)

        if is_not_none(vrf_name):
            vrf_name_ = SubElement(ipv4_, 'ping-act:vrf-name')
            vrf_name_.text = vrf_name

        if is_not_none(source):
            source_ = SubElement(ipv4_, 'ping-act:source')
            source_.text = source

        if is_not_none(verbose):
            verbose_ = SubElement(ipv4_, 'ping-act:verbose')
            verbose_.text = convert_to_string(verbose)

        if is_not_none(type_of_service):
            type_of_service_ = SubElement(ipv4_, 'ping-act:type-of-service')
            type_of_service_.text = convert_to_string(type_of_service)

        if is_not_none(do_not_frag):
            do_not_frag_ = SubElement(ipv4_, 'ping-act:do-not-frag')
            do_not_frag_.text = convert_to_string(do_not_frag)

        if is_not_none(validate):
            validate_ = SubElement(ipv4_, 'ping-act:validate')
            validate_.text = convert_to_string(validate)