Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add service_type argument to service create/update #64

Merged
merged 1 commit into from
May 13, 2024

Conversation

mamullen13316
Copy link
Collaborator

Adds a service_type argument to create_service() and update_service() so that additional service types can be supported.

  • TCPorUDP (already supported)
  • IP
  • ICMP
  • ICMPv6

When creating/updating IP services, it is only necessary to specify the protocol as it is shown in the UI. The protocol number is shown in the UI, however it is not used in the API. Similarly, for ICMP the types and codes should be provided using their names as shown in the UI rather than the numbers.

Examples:

resp = fw.create_service(name="test_esp", service_type="IP", service_list=[{"protocol": "ESP"}])

resp
{'Response': {'@APIVersion': '2000.2',
  '@IPS_CAT_VER': '1',
  '@IS_WIFI6': '0',
  'Login': {'status': 'Authentication Successful'},
  'Services': {'@transactionid': '',
   'Status': {'@code': '200',
    '#text': 'Configuration applied successfully.'}}}}

 resp = fw.update_service(name="test_esp", service_type="IP", service_list=[{"protocol": "AH"}])

 resp
{'Response': {'@APIVersion': '2000.2',
  '@IPS_CAT_VER': '1',
  '@IS_WIFI6': '0',
  'Login': {'status': 'Authentication Successful'},
  'Services': {'@transactionid': '',
   'Status': {'@code': '200',
    '#text': 'Configuration applied successfully.'}}}}

 fw.create_service(name="test_icmp_tracert", service_type="ICMP", service_list=[{"icmp_type": "Traceroute", "icmp_code": "Any Code"}])
 
{'Response': {'@APIVersion': '2000.2',
  '@IPS_CAT_VER': '1',
  '@IS_WIFI6': '0',
  'Login': {'status': 'Authentication Successful'},
  'Services': {'@transactionid': '',
   'Status': {'@code': '200',
    '#text': 'Configuration applied successfully.'}}}}

fw.update_service(name="test_icmp_tracert", service_type="ICMP", service_list=[{"icmp_type": "Destination Unreachable", "icmp_code": "Port Unreachable"}])
{'Response': {'@APIVersion': '2000.2',
  '@IPS_CAT_VER': '1',
  '@IS_WIFI6': '0',
  'Login': {'status': 'Authentication Successful'},
  'Services': {'@transactionid': '',
   'Status': {'@code': '200',
    '#text': 'Configuration applied successfully.'}}}}

@mamullen13316 mamullen13316 merged commit 3ba2e35 into main May 13, 2024
6 checks passed
@mamullen13316 mamullen13316 deleted the service_type branch May 13, 2024 21:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant