lte/gateway/python/magma/captive_portal/rpc_servicer.py
def _get_whitelist_rules(self) -> List[DynamicRuleInstall]:
        """
        Get a list of dynamic rules to install for whitelisting.
        These rules will whitelist traffic to/from the captive portal server.
        """
        dynamic_rules = []
        for ip, ports in self.ip_whitelist.items():
            if ip == 'local':
                ip = '192.168.128.1'
            for port in ports:
                # Build the rule id to be globally unique
                rule_id_info = {
                    'ip': ip,
                    'port': port,
                }
                rule_id = "whitelist_policy_id-{ip}:{port}"\
                    .format(**rule_id_info)

                rule = DynamicRuleInstall(
                    policy_rule=self._get_whitelist_policy_rule(
                        rule_id, ip, port
                    ),
                )
                # Activate now, and deactivate long in the future
                t2 = datetime.now()
                t2 = t2.replace(year=t2.year + 1)
                rule.activation_time.FromDatetime(datetime.now())
                rule.deactivation_time.FromDatetime(t2)
                dynamic_rules.append(rule)
        return dynamic_rules

        Get a list of dynamic rules to install for whitelisting.
        These rules will whitelist traffic to/from the captive portal server.
        
Get a list of dynamic rules to install for whitelisting.
These rules will whitelist traffic to/from the captive portal server.
Get a list of dynamic rules to install for whitelisting . These rules will whitelist traffic to / from the captive portal server .
def _get_whitelist_rules(self) -> List[DynamicRuleInstall]:
        dynamic_rules = []
        for ip, ports in self.ip_whitelist.items():
            if ip == 'local':
                ip = '192.168.128.1'
            for port in ports:
                rule_id_info = {
                    'ip': ip,
                    'port': port,
                }
                rule_id = "whitelist_policy_id-{ip}:{port}"\
                    .format(**rule_id_info)
                rule = DynamicRuleInstall(
                    policy_rule=self._get_whitelist_policy_rule(
                        rule_id, ip, port
                    ),
                )
                t2 = datetime.now()
                t2 = t2.replace(year=t2.year + 1)
                rule.activation_time.FromDatetime(datetime.now())
                rule.deactivation_time.FromDatetime(t2)
                dynamic_rules.append(rule)
        return dynamic_rules
def _get_whitelist_rules ( self ) -> List [ DynamicRuleInstall ] : dynamic_rules = [ ] for ip , ports in self . ip_whitelist . items ( ) : if ip == 'local' : ip = '192.168.128.1' for port in ports : rule_id_info = { 'ip' : ip , 'port' : port , } rule_id = "whitelist_policy_id-{ip}:{port}" . format ( ** rule_id_info ) rule = DynamicRuleInstall ( policy_rule = self . _get_whitelist_policy_rule ( rule_id , ip , port ) , ) t2 = datetime . now ( ) t2 = t2 . replace ( year = t2 . year + 1 ) rule . activation_time . FromDatetime ( datetime . now ( ) ) rule . deactivation_time . FromDatetime ( t2 ) dynamic_rules . append ( rule ) return dynamic_rules
Get a list of dynamic rules to install for whitelisting.
Get a list of dynamic rules to install for whitelisting .
"""
        Get a list of dynamic rules to install for whitelisting.
        These rules will whitelist traffic to/from the captive portal server.
        """ # Build the rule id to be globally unique # Activate now, and deactivate long in the future
self