@contrail.set_auth_token
def _show_resource(self):
    np_obj = self.vnc_lib().network_policy_read(id=self.resource_id)
    dict = {}
    dict['name'] = np_obj.get_display_name()
    dict['fq_name'] = np_obj.get_fq_name_str()
    rules = []
    entries = np_obj.get_network_policy_entries()
    if entries:
        for rule in entries.get_policy_rule():
            policy_rule = {}
            policy_rule['direction'] = rule.get_direction()
            policy_rule['protocol'] = rule.get_protocol()
            policy_rule['dst_addresses'] = []
            for addr in (rule.get_dst_addresses() or []):
                policy_rule['dst_addresses'].append(addr.get_virtual_network())
            a_list = rule.get_action_list()
            policy_rule['action_list'] = {'simple_action': a_list.get_simple_action(), 'apply_service': a_list.get_apply_service(), 'mirror_to': a_list.get_mirror_to()}
            policy_rule['dst_ports'] = rule.get_dst_ports()
            policy_rule['application'] = rule.get_application()
            policy_rule['src_addresses'] = []
            for addr in (rule.get_src_addresses() or []):
                policy_rule['src_addresses'].append(addr.get_virtual_network())
            policy_rule['src_ports'] = rule.get_src_ports()
            rules.append(policy_rule)
    dict['rules'] = rules
    return dict
@contrail.set_auth_token
def _show_resource(self):
    np_obj = self.vnc_lib().network_policy_read(id=self.resource_id)
    dict = {}
    dict['name'] = np_obj.get_display_name()
    dict['fq_name'] = np_obj.get_fq_name_str()
    rules = []
    entries = np_obj.get_network_policy_entries()
    if entries:
        for rule in entries.get_policy_rule():
            policy_rule = {}
            policy_rule['direction'] = rule.get_direction()
            policy_rule['protocol'] = rule.get_protocol()
            policy_rule['dst_addresses'] = []
            for addr in (rule.get_dst_addresses() or []):
                policy_rule['dst_addresses'].append(addr.get_virtual_network())
            a_list = rule.get_action_list()
            policy_rule['action_list'] = {'simple_action': a_list.get_simple_action(), 'apply_service': a_list.get_apply_service(), 'mirror_to': a_list.get_mirror_to()}
            policy_rule['dst_ports'] = rule.get_dst_ports()
            policy_rule['application'] = rule.get_application()
            policy_rule['src_addresses'] = []
            for addr in (rule.get_src_addresses() or []):
                policy_rule['src_addresses'].append(addr.get_virtual_network())
            policy_rule['src_ports'] = rule.get_src_ports()
            rules.append(policy_rule)
    dict['rules'] = rules
    return dict