For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Forum Discussion

Jonathan12's avatar
Jonathan12
Icon for Nimbostratus rankNimbostratus
May 05, 2020

Issues updating a fastl4 profile using Python SDK

I have a very small/simple fastl4 profile based on the default. I want to disable syn-cookie-enable, which is pretty easy from the CLI:

modify ltm profile cookie-all-fastl4 syn-cookie-enable disable

This results in the following:

ltm profile fastl4 cookie-all-fastl4 {

   app-service none

   defaults-from fastL4

syn-cookie-enable disabled

}

 

I have not had much success trying to do the same with the Python SDK.

 

If I use the load/update method it will create an entirely custom configuration.

cookie = bigip.tm.ltm.profile.fastl4s.fastl4.load(name='cookie-tcp-fastl4')

cookie.synCookieEnable='disabled'

cookie.update()

 

The result is this:

ltm profile fastl4 cookie-tcp-fastl4 {

   app-service none

   client-timeout 30

   defaults-from fastL4

   description none

   explicit-flow-migration disabled

   hardware-syn-cookie disabled

   idle-timeout 300

   ip-df-mode preserve

   ip-tos-to-client pass-through

   ip-tos-to-server pass-through

   ip-ttl-mode decrement

   ip-ttl-v4 255

   ip-ttl-v6 64

   keep-alive-interval disabled

   late-binding disabled

   link-qos-to-client pass-through

   link-qos-to-server pass-through

   loose-close disabled

   loose-initialization disabled

   mss-override 0

   other-pva-clientpkts-threshold 2

   other-pva-offload-direction bidirectional

   other-pva-serverpkts-threshold 1

   other-pva-whento-offload after-packets-per-direction

   priority-to-client pass-through

   priority-to-server pass-through

   pva-acceleration full

   pva-dynamic-client-packets 1

   pva-dynamic-server-packets 0

   pva-flow-aging enabled

   pva-flow-evict enabled

   pva-offload-dynamic enabled

   pva-offload-dynamic-priority disabled

   pva-offload-initial-priority medium

   pva-offload-state embryonic

   reassemble-fragments disabled

   receive-window-size 0

   reset-on-timeout enabled

   rtt-from-client disabled

   rtt-from-server disabled

   server-sack disabled

   server-timestamp disabled

   software-syn-cookie disabled

   syn-cookie-enable disabled

   syn-cookie-mss 0

   syn-cookie-whitelist disabled

   tcp-close-timeout 5

   tcp-generate-isn disabled

   tcp-handshake-timeout 5

   tcp-pva-offload-direction bidirectional

   tcp-pva-whento-offload embryonic

   tcp-strip-sack disabled

   tcp-time-wait-timeout 0

   tcp-timestamp-mode preserve

   tcp-wscale-mode preserve

   timeout-recovery disconnect

}

This is undesirable because now I have to manage changes in both the default fastl4 profile and this cookie profile as well.

 

If I try to use the modify method I get an error:

cookie=bigip.tm.ltm.profile.fastl4s.fastl4.modify(name='cookie-tcp-fastl4', synCookieEnable='disabled')

 File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/f5/bigip/resource.py", line 411, in modify

   self._modify(**patch)

 File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/f5/bigip/resource.py", line 392, in _modify

   self._prepare_put_or_patch(patch)

 File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/f5/bigip/resource.py", line 425, in _prepare_put_or_patch

   update_uri = self._meta_data['uri']

KeyError: 'uri'

 

I'm not sure why the syntax is wrong, I use a very similar syntax for all sorts of other Resources.

No RepliesBe the first to reply