def cli(self, output=None):
    if (output is None):
        out = self.device.execute(self.cli_command)
    else:
        out = output
    p1 = re.compile('^(?P<name>[\\w\\-\\/\\.]+) +(?P<mode>\\w+) +(?P<encapsulation>\\S+) +(?P<status>\\w+) +(?P<native_vlan>\\d+)$')
    p2 = re.compile('^Port +Vlans +allowed +on +trunk$')
    p3 = re.compile('^Port +Vlans +allowed +and +active +in +management +domain$')
    p4 = re.compile('^Port +Vlans +in +spanning +tree +forwarding +state +and +not +pruned$')
    p5 = re.compile('^(?P<name>[\\w\\-\\/\\.]+) +(?P<vlans>none\\s*|[\\d\\-\\,\\s]+)$')
    ret_dict = {}
    vlan_list_type = None
    for line in out.splitlines():
        line = line.strip()
        m = p1.match(line)
        if m:
            group = m.groupdict()
            intf = Common.convert_intf_name(group.pop('name'))
            intf_dict = ret_dict.setdefault('interface', {}).setdefault(intf, {})
            intf_dict['name'] = intf
            intf_dict.update({k: v for (k, v) in group.items()})
            continue
        if p2.match(line):
            vlan_list_type = 'vlans_allowed_on_trunk'
            continue
        if p3.match(line):
            vlan_list_type = 'vlans_allowed_active_in_mgmt_domain'
            continue
        if p4.match(line):
            vlan_list_type = 'vlans_in_stp_forwarding_not_pruned'
            continue
        m = p5.match(line)
        if m:
            group = m.groupdict()
            intf = Common.convert_intf_name(group['name'])
            intf_dict = ret_dict.setdefault('interface', {}).setdefault(intf, {})
            (intf_dict.setdefault(vlan_list_type, group['vlans']) if group['vlans'] else None)
            continue
    return ret_dict
def cli(self, output=None):
    if (output is None):
        out = self.device.execute(self.cli_command)
    else:
        out = output
    p1 = re.compile('^(?P<name>[\\w\\-\\/\\.]+) +(?P<mode>\\w+) +(?P<encapsulation>\\S+) +(?P<status>\\w+) +(?P<native_vlan>\\d+)$')
    p2 = re.compile('^Port +Vlans +allowed +on +trunk$')
    p3 = re.compile('^Port +Vlans +allowed +and +active +in +management +domain$')
    p4 = re.compile('^Port +Vlans +in +spanning +tree +forwarding +state +and +not +pruned$')
    p5 = re.compile('^(?P<name>[\\w\\-\\/\\.]+) +(?P<vlans>none\\s*|[\\d\\-\\,\\s]+)$')
    ret_dict = {}
    vlan_list_type = None
    for line in out.splitlines():
        line = line.strip()
        m = p1.match(line)
        if m:
            group = m.groupdict()
            intf = Common.convert_intf_name(group.pop('name'))
            intf_dict = ret_dict.setdefault('interface', {}).setdefault(intf, {})
            intf_dict['name'] = intf
            intf_dict.update({k: v for (k, v) in group.items()})
            continue
        if p2.match(line):
            vlan_list_type = 'vlans_allowed_on_trunk'
            continue
        if p3.match(line):
            vlan_list_type = 'vlans_allowed_active_in_mgmt_domain'
            continue
        if p4.match(line):
            vlan_list_type = 'vlans_in_stp_forwarding_not_pruned'
            continue
        m = p5.match(line)
        if m:
            group = m.groupdict()
            intf = Common.convert_intf_name(group['name'])
            intf_dict = ret_dict.setdefault('interface', {}).setdefault(intf, {})
            (intf_dict.setdefault(vlan_list_type, group['vlans']) if group['vlans'] else None)
            continue
    return ret_dict