Example #1
0
 def announced_networks(self):
     """
     Show all announced networks for the BGP configuration.
     Returns tuple of advertised network, routemap. Route
     map may be None.
     ::
     
         for advertised in engine.bgp.advertisements:
             net, route_map = advertised
     
     :return: list of tuples (advertised_network, route_map).
     """
     return [(Element.from_href(ne.get('announced_ne_ref')),
              Element.from_href(ne.get('announced_rm_ref')))
              for ne in self.data.get('announced_ne_setting')]
Example #2
0
 def domain(self):
     """
     Domain this permission applies to. Shared Domain if unspecified.
     
     :rtype: AdminDomain
     """
     return Element.from_href(self.get('granted_domain_ref', 'Shared Domain'))
Example #3
0
 def modified_by(self):
     """
     The account that last modified this element.
     
     :rtype: Element
     """
     return Element.from_href(self.modifier)
Example #4
0
 def physical_interface(self):
     """
     Physical interface for this endpoint.
     
     :rtype: PhysicalInterface
     """
     return Element.from_href(self.data.get('physical_interface'))
Example #5
0
    def neighbor_as(self):
        """
        AutonomousSystem for this external BGP peer

        :return: :class:`~AutonomousSystem` element
        """
        return Element.from_href(self.data.get('neighbor_as'))
Example #6
0
    def __iter__(self):
        for condition in self.conditions:
            condition_type = condition.get('type')
            if 'element' in condition_type:
                entry = Element.from_href(condition.get('access_list_ref'))
                condition_type = 'access_list'
            elif 'metric' in condition_type:
                entry = Metric(condition.get('metric'))
            elif 'peer_address' in condition_type:
                ref = 'fwcluster_peer_address_ref' if 'fwcluster_peer_address_ref'\
                    in condition else 'external_bgp_peer_address_ref'
                entry = Element.from_href(condition.get(ref))
            elif 'next_hop' in condition_type:
                entry = Element.from_href(condition.get('next_hop_ref'))

            yield Condition(condition.get('rank'), entry, condition_type)
Example #7
0
    def vpn_profile(self):
        """
        Specified VPN Profile used by this VPN Policy

        :return: :class:`smc.vpn.elements.VPNProfile`
        """
        return Element.from_href(self.data.get('vpn_profile'))
Example #8
0
    def domain_settings_ref(self):
        """
        OSPF Domain Settings profile used for this OSPF Profile

        :return: :class:`~OSPFDomainSetting`
        """
        return Element.from_href(self.data.get('domain_settings_ref'))
Example #9
0
 def data_context(self):
     """
     The type of log data that is forwarded.
     :rtype: DataContext
     """
     return (Element.from_href(self.get("data_context"))
             if self.get("data_context") is not None else None)
Example #10
0
    def parent_policy(self):
        """
        Read-only name of the parent policy

        :return: :class:`smc.base.model.Element` of type policy
        """
        return Element.from_href(self.data.get('parent_policy'))
Example #11
0
 def netlink(self):
     """
     The static netlink referenced in this multilink member
     
     :rtype: StaticNetlink
     """
     return Element.from_href(self.data.get('netlink_ref'))
Example #12
0
 def location(self):
     """
     Location name for contact address
      
     :rtype: str
     """
     return Element.from_href(self.location_ref)
Example #13
0
    def parent_policy(self):
        """
        Read-only name of the parent policy

        :return: :class:`smc.base.model.Element` of type policy
        """
        return Element.from_href(self.data.get("parent_policy"))
Example #14
0
 def location(self):
     """
     Location name for contact address
     
     :rtype: str
     """
     return Element.from_href(self.location_ref).name
Example #15
0
    def announced_networks(self):
        """
        Show all announced networks for the BGP configuration.
        Returns tuple of advertised network, routemap. Route
        map may be None.
        ::

            for advertised in engine.bgp.advertisements:
                net, route_map = advertised

        :return: list of tuples (advertised_network, route_map).
        """
        return [(
            Element.from_href(ne.get("announced_ne_ref")),
            Element.from_href(ne.get("announced_rm_ref")),
        ) for ne in self.data.get("announced_ne_setting")]
Example #16
0
 def modified_by(self):
     """
     The account that last modified this element.
     
     :rtype: Element
     """
     return Element.from_href(self.modifier)
    def users(self):
        """
        List of users required to authenticate

        :return: list
        """
        return [Element.from_href(user) for user in self.get('users', [])]
    def methods(self):
        """
        Read only authentication methods enabled

        :return: list value: auth methods enabled
        """
        return [Element.from_href(method) for method in self.get('methods')]
Example #19
0
    def users(self):
        """
        List of users required to authenticate

        :return: list
        """
        return [Element.from_href(user) for user in self.get('users', [])]
Example #20
0
    def methods(self):
        """
        Read only authentication methods enabled

        :return: list value: auth methods enabled
        """
        return [Element.from_href(method) for method in self.get('methods')]
Example #21
0
    def connection_profile(self):
        """
        BGP Connection Profile used by this BGP Peering.

        :return: :class:`~BGPConnectionProfile`
        """
        return Element.from_href(self.data.get('connection_profile'))
Example #22
0
    def subnet_distance(self):
        """
        Specific subnet administrative distances

        :return: list of tuple (subnet, distance)
        """
        return [(Element.from_href(entry.get('subnet')), entry.get('distance'))
                for entry in self.data.get('distance_entry')]
Example #23
0
 def sub_policy(self): 
     """ 
     Sub policy is used when ``action=jump``. 
      
     :rtype: FirewallSubPolicy 
     """ 
     if 'sub_policy' in self: 
         return Element.from_href(self.get('sub_policy')) 
    def permissions(self):
        """
        Elements associated to this permission. Granted elements can be
        Engines, Policies or other Access Control Lists.

        :return: Element class deriving from :py:class:`smc.base.model.Element`
        """
        return [Element.from_href(e) for e in self.granted_element]
Example #25
0
    def permissions(self):
        """
        Elements associated to this permission. Granted elements can be
        Engines, Policies or other Access Control Lists.

        :return: Element class deriving from :py:class:`smc.base.model.Element`
        """
        return [Element.from_href(e) for e in self.granted_element]
Example #26
0
 def granted_elements(self):
     """
     List of elements this permission has rights to. Elements will be of type
     Engine, Policy or ACLs
     
     :rtype: list(Element)
     """
     return [Element.from_href(element) for element in self.get('granted_elements')]
Example #27
0
 def http_proxy(self):
     """    
     Return any HTTP Proxies that are configured for Sandbox.
     
     :return: list of http proxy instances
     :rtype: list(HttpProxy)
     """
     return [Element.from_href(proxy) for proxy in self.get('http_proxy')]
Example #28
0
 def policy(self):
     """
     Policy associated with this task
     
     :return: Policy as element
     :rtype: Element
     """
     return Element.from_href(self.data.get('policy'))
Example #29
0
 def rule(self):
     """
     Return the Rule element for this rule counter. A rule may be from
     the policy or the policy template.
     
     :rtype: Rule
     """
     return Element.from_href(self.rule_ref)
Example #30
0
    def resource(self):
        """
        The resource/s associated with this task

        :rtype: list(Element)
        """
        return [Element.from_href(resource)
                for resource in self.data.get('resource', [])]
Example #31
0
 def auth_method(self):
     """
     Default authentication method for this LDAP User Domain. Can
     also be set on the LDAP server as well.
     
     :rtype: AuthenticationService
     """
     return Element.from_href(self.data.get('auth_method'))
Example #32
0
 def ldap_server(self):
     """
     LDAP Servers associated with this ExternalLdapUserDomain. You must
     have at least one ldap server but can have multiple.
     
     :rtype: ActiveDirectoryServer
     """
     return [Element.from_href(server) for server in self.data.get('ldap_server', [])]
Example #33
0
 def http_proxy(self):
     """    
     Return any HTTP Proxies that are configured for Sandbox.
     
     :return: list of http proxy instances
     :rtype: list(HttpProxy)
     """
     return [Element.from_href(proxy) for proxy in self.get('http_proxy')]
Example #34
0
 def created_by(self):
     """
     The account that created this element. Returned as 
     an Element.
     
     :rtype: Element
     """
     return Element.from_href(self.creator)
Example #35
0
 def vpn_profile(self):
     """
     VPN profile for this RBVPN
     
     :rtype: VPNProfile
     """
     if self.data.get('vpn_profile_ref'):
         return Element.from_href(self.vpn_profile_ref)
Example #36
0
    def obtain_members(self):
        """
        Obtain all group members from this group

        :return: group members as elements
        :rtype: list(Element)
        """
        return [Element.from_href(member) for member in self.data.get("element", [])]
Example #37
0
    def gateway(self):
        """
        The gateway (engine) that this netlink is used on.

        :return: Element type for engine
        :rtype: Element
        """
        return Element.from_href(self.data.get('gateway_ref'))
Example #38
0
    def networks(self):
        """
        List of networks this static netlink uses.

        :return: networks associated with this netlink, as Element
        :rtype: Element
        """
        return [Element.from_href(element) for element in self.data.get('ref')]
Example #39
0
    def protocol_agent(self):
        """ Protocol Agent for this service

        :return: :py:class:`smc.elements.service.Protocol` or None
        """
        href = self.data.get('protocol_agent_ref')
        if href:
            return Element.from_href(href)
Example #40
0
def from_meta(node):
    """
    Helper method that reolves a routing node to element. Rather than doing
    a lookup and fetch, the routing node provides the information to
    build the element from meta alone.
    
    :rtype: Element
    """
    # Version SMC < 6.4
    if not node.related_element_type:
        return Element.from_href(node.data.get('href'))

    # SMC Version >= 6.4 - more efficient because it builds the
    # element by meta versus requiring a query
    return Element.from_meta(name=node.data.get('name'),
                             type=node.related_element_type,
                             href=node.data.get('href'))
Example #41
0
 def sub_policy(self):
     """ 
     Sub policy is used when ``action=jump``. 
      
     :rtype: FirewallSubPolicy 
     """
     if 'sub_policy' in self:
         return Element.from_href(self.get('sub_policy'))
Example #42
0
    def gateway(self):
        """
        The gateway (engine) that this netlink is used on. You can set
        the gateway by providing an element of type Engine or Router.

        :rtype: Element
        """
        return Element.from_href(self.data.get('gateway_ref'))
Example #43
0
    def subnet_distance(self):
        """
        Specific subnet administrative distances

        :return: list of tuple (subnet, distance)
        """
        return [(Element.from_href(entry.get('subnet')), entry.get('distance'))
                for entry in self.data.get('distance_entry')]
Example #44
0
 def role(self):
     """
     Specific Role assigned to this permission. A role is what allows read/write
     access to specific operations on the granted elements
     
     :rtype: Role
     """
     return Element.from_href(self.get('role_ref'))
Example #45
0
 def rule(self):
     """
     Return the Rule element for this rule counter. A rule may be from
     the policy or the policy template.
     
     :rtype: Rule
     """
     return Element.from_href(self.rule_ref)
Example #46
0
    def protocol_agent(self):
        """ Protocol Agent for this service

        :return: Return the protocol agent or None if this service does not
            reference a protocol agent
        :rtype: ProtocolAgent
        """
        if 'protocol_agent_ref' in self.data:
            return Element.from_href(self.protocol_agent_ref)
Example #47
0
    def site_element(self):
        """
        Site elements for this VPN Site.

        :return: Elements used in this VPN site
        :rtype: list(Element)
        """
        return [Element.from_href(element)
                for element in self.data.get('site_element')]
Example #48
0
 def gateway(self):
     """
     The VPN gateway for this node. This is either an internal gateway
     or an external gateway
     
     :return: the VPN gateway
     :rtype: Element
     """ 
     return Element.from_href(self.data['gateway'])
Example #49
0
 def server_credentials(self):
     """
     Return a list of assigned (if any) TLSServerCredentials
     assigned to this engine.
     
     :rtype: list(TLSServerCredential)
     """
     return [Element.from_href(credential)
             for credential in self.engine.server_credential]
Example #50
0
 def browse(self):
     """
     Browse the elements nested below this Domain or Group.
     Results could be internal users or groups.
     
     :return: list of Element by type
     :rtype: list
     """
     return [Element.from_meta(**element)
         for element in self.make_request(resource='browse')]
Example #51
0
 def vpn(self): 
     """ 
     Return vpn reference. Only used if 'enforce_vpn', 'apply_vpn', 
     or 'forward_vpn' is the action type. 
  
     :param PolicyVPN value: set the policy VPN for VPN action
     :rtype: PolicyVPN 
     """ 
     if 'vpn' in self: 
         return Element.from_href(self.get('vpn'))
Example #52
0
 def resources(self):
     """
     Resources associated with this task. Depending on the task, this
     may be engines, policies, servers, etc.
     
     :return: list of Elements
     :rtype: list
     """
     return [Element.from_href(href)
             for href in self.data.get('resources')]
Example #53
0
def from_meta(node):
    """
    Helper method that reolves a routing node to element. Rather than doing
    a lookup and fetch, the routing node provides the information to
    build the element from meta alone.
    
    :rtype: Element
    """
    # Version SMC < 6.4
    if 'related_element_type' not in node.data:
        return Element.from_href(
            node.data.get('href'))
    
    # SMC Version >= 6.4 - more efficient because it builds the
    # element by meta versus requiring a query
    return Element.from_meta(
        name=node.data.get('name'),
        type=node.related_element_type,
        href=node.data.get('href'))
Example #54
0
 def tls_policy(self):
     """
     The HTTPSInspectionExceptions element referenced in this protocol
     agent parameter. Will be None if one is not assigned.
     
     :return: The https inspection exceptions element or None if not
         assigned
     :rtype: HTTPSInspectionExceptions
     """
     if self._tls_inspection_policy_ref:
         return Element.from_href(self._tls_inspection_policy_ref)
Example #55
0
    def __iter__(self):
        for condition in self.conditions:
            condition_type = condition.get('type')
            if 'element' in condition_type:
                entry = Element.from_href(
                    condition.get('access_list_ref'))
                condition_type = 'access_list'
            elif 'metric' in condition_type:
                entry = Metric(
                    condition.get('metric'))
            elif 'peer_address' in condition_type:
                ref = 'fwcluster_peer_address_ref' if 'fwcluster_peer_address_ref'\
                    in condition else 'external_bgp_peer_address_ref'
                entry = Element.from_href(
                    condition.get(ref))
            elif 'next_hop' in condition_type:
                entry = Element.from_href(
                    condition.get('next_hop_ref'))

            yield Condition(condition.get('rank'), entry, condition_type)
Example #56
0
 def goto(self):
     """
     If the rule is set to goto a rule section, return
     the rule section, otherwise it will return None.
     Check the value of finish to determine if the rule
     is set to finish on match.
     
     :return: RouteMap or None
     """
     return Element.from_href(
         self.data.get('goto'))
Example #57
0
    def used_on(self):
        """
        Used on specific whether this NAT rule has a specific engine that
        this rule applies to. Default is ANY (unspecified).

        :param str,Element value: :py:class:`smc.elements.network` element to
               apply to this NAT rule, or str href
        :return: Element value: name of element this NAT rule is applied on
        """
        if 'used_on' in self.data:
            return Element.from_href(self.data.get('used_on'))
Example #58
0
 def endpoint(self):
     """
     Endpoint is used to specify which interface is enabled for
     VPN. This is the InternalEndpoint property of the
     InternalGateway.
     
     :return: internal endpoint where VPN is enabled
     :rtype: InternalEndpoint,ExternalGateway
     """
     if self.endpoint_ref and self.tunnel_interface_ref:
         return InternalEndpoint(href=self.endpoint_ref)
     return Element.from_href(self.endpoint_ref)
Example #59
0
    def vss_contexts(self):
        """
        Return all virtual contexts for this VSS Container.

        :return list VSSContext
        """
        result = self.make_request(
            href=fetch_entry_point('visible_virtual_engine_mapping'),
            params={'filter': self.name})
        if result.get('mapping', []):
            return [Element.from_href(ve)
                for ve in result['mapping'][0].get('virtual_engine', [])]
        return []
Example #60
0
    def used_on(self):
        """
        Return all NAT'd elements using this location. 

        .. note::
            Available only in SMC version 6.2

        :return: elements used by this location
        :rtype: list
        """
        return [Element.from_meta(**element)
                for element in
                self.make_request(resource='search_nated_elements_from_location')]