def view_vrf(arg, opts, shell_opts):
if arg is None:<EOL><INDENT>print("<STR_LIT>", file=sys.stderr)<EOL>sys.exit(<NUM_LIT:1>)<EOL><DEDENT>if arg.lower() in ('<STR_LIT:->', '<STR_LIT:none>'):<EOL><INDENT>arg = None<EOL><DEDENT>try:<EOL><INDENT>v = VRF.search({<EOL>'<STR_LIT>': '<STR_LIT>',<EOL>'<STR_LIT>': '<STR_LIT>',<EOL>'<STR_LIT>': arg }<EOL>)['<STR_LIT:result>'][<NUM_LIT:0>]<EOL><DEDENT>except (KeyError, IndexError):<EOL><INDENT>print("<STR_LIT>" % str(arg), file=sys.stderr)<EOL>sys.exit(<NUM_LIT:1>)<EOL><DEDENT>print("<STR_LIT>")<EOL>print("<STR_LIT>" % ("<STR_LIT>", v.id))<EOL>print("<STR_LIT>" % ("<STR_LIT>", v.rt))<EOL>print("<STR_LIT>" % ("<STR_LIT:Name>", v.name))<EOL>print("<STR_LIT>" % ("<STR_LIT>", v.description))<EOL>print("<STR_LIT>")<EOL>if v.avps is not None:<EOL><INDENT>for key in sorted(v.avps, key=lambda s: s.lower()):<EOL><INDENT>print("<STR_LIT>" % (key, v.avps[key]))<EOL><DEDENT><DEDENT>print("<STR_LIT>")<EOL>for tag_name in sorted(v.tags, key=lambda s: s.lower()):<EOL><INDENT>print("<STR_LIT>" % tag_name)<EOL><DEDENT>if v.total_addresses_v4 == <NUM_LIT:0>:<EOL><INDENT>used_percent_v4 = <NUM_LIT:0><EOL><DEDENT>else:<EOL><INDENT>used_percent_v4 = (float(v.used_addresses_v4)/v.total_addresses_v4)*<NUM_LIT:100><EOL><DEDENT>if v.total_addresses_v6 == <NUM_LIT:0>:<EOL><INDENT>used_percent_v6 = <NUM_LIT:0><EOL><DEDENT>else:<EOL><INDENT>used_percent_v6 = (float(v.used_addresses_v6)/v.total_addresses_v6)*<NUM_LIT:100><EOL><DEDENT>print("<STR_LIT>")<EOL>print("<STR_LIT>" % ("<STR_LIT>", v.num_prefixes_v4))<EOL>print("<STR_LIT>" % ("<STR_LIT>",<EOL>v.used_addresses_v4, v.free_addresses_v4, used_percent_v4,<EOL>v.total_addresses_v4))<EOL>print("<STR_LIT>" % ("<STR_LIT>", v.num_prefixes_v6))<EOL>print("<STR_LIT>" % ("<STR_LIT>",<EOL>v.used_addresses_v6, v.free_addresses_v6, used_percent_v6,<EOL>v.total_addresses_v6))<EOL>
View a single VRF