def test_open_port_tcp_no_comment(location, system_context): ipt.install_rules(location, system_context) ipt.open_port(system_context, 4242, protocol="tcp", comment="test port") _validate_rules_files(system_context, "-A TCP -p tcp -m tcp --dport 4242 -j ACCEPT")
def test_open_port_udp_no_comment(location, system_context): ipt.install_rules(location, system_context) ipt.open_port(system_context, 4242, protocol="udp") _validate_rules_files(system_context, "-A UDP -p udp -m udp --dport 4242 -j ACCEPT")
def test_open_port_default_no_comment(location, system_context): ipt.install_rules(location, system_context) ipt.open_port(system_context, 4242) _validate_rules_files(system_context, "-A TCP -p tcp -m tcp --dport 4242 -j ACCEPT")
def test_open_port_udp(location, system_context): ipt.install_rules(location, system_context) ipt.open_port(system_context, 4242, protocol='udp', comment='test port') _validate_rules_files(system_context, '# test port:', '-A UDP -p udp -m udp --dport 4242 -j ACCEPT')
def test_open_port_default(location, system_context): ipt.install_rules(location, system_context) ipt.open_port(system_context, 4242, comment='test port') _validate_rules_files(system_context, '# test port:', '-A TCP -p tcp -m tcp --dport 4242 -j ACCEPT')
def __call__( self, location: Location, system_context: SystemContext, *args: typing.Any, **kwargs: typing.Any, ) -> None: """Execute command.""" protocol = kwargs.get("protocol", "tcp") comment = kwargs.get("comment", "") open_port(system_context, args[0], protocol=protocol, comment=comment)
def __call__(self, location: Location, system_context: SystemContext, *args: typing.Any, **kwargs: typing.Any) -> None: """Execute command.""" protocol = kwargs.get('protocol', 'tcp') comment = kwargs.get('comment', None) open_port(system_context, args[0], protocol=protocol, comment=comment)