def test_ipv6_neigh(): result = ip.Ipv6Neigh(context_wrap(IPV6_NEIGH_CONTEXT)) assert len(result.data) == 2 assert len(result["ff02::16"]) == 4 assert len(result["ff02::1:ffea:2c00"]) == 4 assert result["ff02::16"] == { "dev": "vlinuxbr", "nud": "NOARP", "lladdr": "33:33:00:00:00:16", 'addr': ipaddress.ip_address(u'ff02::16') } assert result["ff02::1:ffea:2c00"] == { "dev": "tun0", "nud": "NOARP", "lladdr": "33:33:ff:ea:2c:00", 'addr': ipaddress.ip_address(u'ff02::1:ffea:2c00') }
def test_ipv4_neigh(): result = ip.Ipv4Neigh(context_wrap(IPV4_NEIGH_CONTEXT)) assert '172.17.0.18' in result assert len(result.data) == 8 # Test all unreachability detection states assert result["172.17.42.10"] == { "dev": "lo", "lladdr": "00:00:00:00:00:00", "nud": "PERMANENT", 'addr': ipaddress.ip_address(u'172.17.42.10') } assert result["172.17.42.11"] == { "dev": "lo", "lladdr": "00:00:00:00:00:01", "nud": "NOARP", 'addr': ipaddress.ip_address(u'172.17.42.11') } assert result["172.17.42.12"] == { "dev": "lo", "lladdr": "00:00:00:00:00:02", "nud": "REACHABLE", 'addr': ipaddress.ip_address(u'172.17.42.12') } assert result["172.17.42.13"] == { "dev": "lo", "lladdr": "00:00:00:00:00:03", "nud": "STALE", 'addr': ipaddress.ip_address(u'172.17.42.13') } assert result["172.17.42.14"] == { "dev": "lo", "lladdr": "00:00:00:00:00:04", "nud": "DELAY", 'addr': ipaddress.ip_address(u'172.17.42.14') } assert result["172.17.42.15"] == { "dev": "lo", "lladdr": "00:00:00:00:00:05", "nud": "FAILED", 'addr': ipaddress.ip_address(u'172.17.42.15') } assert result["172.17.0.18"] == { "nud": "FAILED", 'addr': ipaddress.ip_address(u'172.17.0.18') } assert result["172.17.0.19"] == { "dev": "docker0", "nud": "FAILED", 'addr': ipaddress.ip_address(u'172.17.0.19') }
@property def conf_path(self): res = self.main.find("ServerRoot") return res.value if res else "/opt/rh/jbcs-httpd24/root/etc/httpd" def get_tree(root=None): """ This is a helper function to get an httpd configuration component for your local machine or an archive. Use it in interactive sessions. """ return run(HttpdConfTree, root=root).get(HttpdConfTree) is_private = pred(lambda x: ip_address(six.u(x)).is_private) """ Predicate to check if an ip address is private. Example: conf["VirtualHost", in_network("128.39.0.0/16")] """ in_network = pred2(lambda x, y: (ip_address(six.u(x)) in ip_network(six.u(y)))) """ Predicate to check if an ip address is in a given network. Example: conf["VirtualHost", in_network("128.39.0.0/16")] """
@property def conf_path(self): res = self.main.find("ServerRoot") return res.value if res else "/etc/httpd" def get_tree(root=None): """ This is a helper function to get an httpd configuration component for your local machine or an archive. It's for use in interactive sessions. """ return run(HttpdConfTree, root=root).get(HttpdConfTree) is_private = UnaryBool(lambda x: ip_address(six.u(x)).is_private) """ Predicate to check if an ip address is private. Example: conf["VirtualHost", in_network("128.39.0.0/16")] """ in_network = BinaryBool(lambda x, y: (ip_address(six.u(x)) in ip_network(six.u(y)))) """ Predicate to check if an ip address is in a given network. Example: conf["VirtualHost", in_network("128.39.0.0/16")] """
@property def conf_path(self): res = self.main.find("ServerRoot") return res.value if res else "/opt/rh/jbcs-httpd24/root/etc/httpd" def get_tree(root=None): """ This is a helper function to get an httpd configuration component for your local machine or an archive. Use it in interactive sessions. """ return run(HttpdConfTree, root=root).get(HttpdConfTree) is_private = lift(lambda x: ip_address(six.u(x)).is_private) """ Predicate to check if an ip address is private. Example: conf["VirtualHost", in_network("128.39.0.0/16")] """ in_network = lift2(lambda x, y: (ip_address(six.u(x)) in ip_network(six.u(y)))) """ Predicate to check if an ip address is in a given network. Example: conf["VirtualHost", in_network("128.39.0.0/16")] """