f5-automation-labs
f5-automation-labs copied to clipboard
Class 2, Lab 3.2 - 400 Bad Request when creating pool member
Hi,
I'm having trouble getting through Class 2, Lab 3.2.
The first build script 'f5-newman-build-1' runs fine and the virtual server is built on bigip-a with no pool member.
The second build script 'f5-newman-build-2', I get a 400 Bad Request when trying to create the pool members with PATCH. I'm not sure how all these newman scripts piece together just yet so it might be user (me) error. Unfortunately, I'm not a DevOps guy (thus the training) and I'm a bit out of my depth here troubleshooting.
Should the method be POST here?
Hey @justingrantit
This just adds the pool member into the pool, which should already be defined, the method is correct since were just modifying. Have you modified the workflows in anyway?
The Newman script calls the the Postman collection looking for step 2, which pulls you in a new token for Auth and then reuses that for added the pool members in
Yes. I can confirm that the pool is there, so PATCH isn't the issue then. Not sure why I'm getting the 400 though.
I haven't modified any of the workflows. Just following the lab guide as best I can.
yeah you shouldnt have to modify anything past workflow 1 ( to add the other collection). you should be getting a console type output of the runner, can you copy that in here? how does it compare to the example in the guide?
Here's the bit gone wrong:
❏ 2 - Add Members to LTM Config
↳ Step 1: Add Members to Pool
PATCH https://10.1.1.10/mgmt/tm/ltm/pool/module_3_pool [400 Bad Request, 1.05KB, 246ms]
┌─────────────────────────┬──────────┬──────────┐
│ │ executed │ failed │
├─────────────────────────┼──────────┼──────────┤
│ iterations │ 1 │ 0 │
├─────────────────────────┼──────────┼──────────┤
│ requests │ 1 │ 0 │
├─────────────────────────┼──────────┼──────────┤
│ test-scripts │ 0 │ 0 │
├─────────────────────────┼──────────┼──────────┤
│ prerequest-scripts │ 0 │ 0 │
├─────────────────────────┼──────────┼──────────┤
│ assertions │ 0 │ 0 │
├─────────────────────────┴──────────┴──────────┤
│ total run duration: 279ms │
├───────────────────────────────────────────────┤
│ total data received: 192B (approx) │
├───────────────────────────────────────────────┤
│ average response time: 246ms │
└───────────────────────────────────────────────┘
So I checked the JSON in f5-programmability-class-2.postman_collection.json and it seems to me to be escaped properly. Confusing.
that destination is perfect, the pool exists on the BIGIP already? all this does is add the pool member. i would expect the 400 if the pool isnt there
when you ran newman-1 you should had got another output for the created objects, tcp, pool, vip ect, did those all pass?
Here's the pool...
root@(bigip-a)(cfg-sync In Sync)(Active)(/Common)(tmos)# list ltm pool
ltm pool module_3_pool {
monitor module_3_http_monitor
}
Yes. From memory everything passed. I don't have the screen output but here's what I can get from the JSON output file:
[snops@f5-super-netops] [~/f5-automation-labs/jenkins/f5-newman-build] $ grep '"code": 200' f5-newman-build-1-2018-04-05-00-28-36-run.json
"code": 200,
"code": 200,
"code": 200,
"code": 200,
"code": 200,
"code": 200,
"code": 200,
"code": 200,
"code": 200,
"code": 200,
"code": 200,
"code": 200,
"code": 200,
"code": 200,
[snops@f5-super-netops] [~/f5-automation-labs/jenkins/f5-newman-build] $ grep '"code": 4' f5-newman-build-1-2018-04-05-00-28-36-run.json
Nothing matches 4xx return code for build-1
yeah you have the pool, thats whats important, can you try running newman-5 and then re-run 1? 5 will have some errors cause not everything has been created yet
5 is the cleanup preparing you for the next section
Same result :(
Build-5 cleans up Build-1 works okay Build-2 fails on new member
[snops@f5-super-netops] [~/f5-automation-labs/jenkins/f5-newman-build] $ f5-newman-wrapper f5-newman-build-5
[f5-newman-build-5-2018-04-05-02-22-05] starting run
[f5-newman-build-5-2018-04-05-02-22-05] [runCollection][Authenticate to BIG-IP] running...
newman
BIGIP_API_Authentication
❏ 1_Authenticate
↳ Authenticate and Obtain Token
POST https://10.1.1.10/mgmt/shared/authn/login [200 OK, 1.57KB, 436ms]
✓ [POST Response Code]=200
✓ [Populate Variable] bigip_token=HJK5U4XVJQSDXC4VNXI52EOXYF
↳ Verify Authentication Works
GET https://10.1.1.10/mgmt/shared/authz/tokens/HJK5U4XVJQSDXC4VNXI52EOXYF [200 OK, 1.39KB, 19ms]
✓ [GET Response Code]=200
✓ [Current Value] token=HJK5U4XVJQSDXC4VNXI52EOXYF
✓ [Check Value] token == HJK5U4XVJQSDXC4VNXI52EOXYF
↳ Set Authentication Token Timeout
PATCH https://10.1.1.10/mgmt/shared/authz/tokens/HJK5U4XVJQSDXC4VNXI52EOXYF [200 OK, 1.39KB, 34ms]
✓ [PATCH Response Code]=200
✓ [Current Value] timeout=1200
✓ [Check Value] timeout == 1200
┌─────────────────────────┬──────────┬──────────┐
│ │ executed │ failed │
├─────────────────────────┼──────────┼──────────┤
│ iterations │ 1 │ 0 │
├─────────────────────────┼──────────┼──────────┤
│ requests │ 3 │ 0 │
├─────────────────────────┼──────────┼──────────┤
│ test-scripts │ 3 │ 0 │
├─────────────────────────┼──────────┼──────────┤
│ prerequest-scripts │ 1 │ 0 │
├─────────────────────────┼──────────┼──────────┤
│ assertions │ 8 │ 0 │
├─────────────────────────┴──────────┴──────────┤
│ total run duration: 1023ms │
├───────────────────────────────────────────────┤
│ total data received: 1.72KB (approx) │
├───────────────────────────────────────────────┤
│ average response time: 163ms │
└───────────────────────────────────────────────┘
[f5-newman-build-5-2018-04-05-02-22-05] [runCollection][5 - Clean Up Service] running...
newman
f5-programmability-class-2
❏ 5 - Clean Up Service
↳ Step 1: Delete a Virtual Server
DELETE https://10.1.1.10/mgmt/tm/ltm/virtual/module_3_vs [200 OK, 906B, 435ms]
↳ Step 2: Delete a TCP Profile
DELETE https://10.1.1.10/mgmt/tm/ltm/profile/tcp/module_3_tcp_clientside [200 OK, 906B, 461ms]
↳ Step 3: Delete a HTTP Profile
DELETE https://10.1.1.10/mgmt/tm/ltm/profile/http/module_3_http [200 OK, 906B, 440ms]
↳ Step 4: Delete a Pool
DELETE https://10.1.1.10/mgmt/tm/ltm/pool/module_3_pool [200 OK, 906B, 328ms]
↳ Step 5: Delete a HTTP Monitor
DELETE https://10.1.1.10/mgmt/tm/ltm/monitor/http/module_3_http_monitor [200 OK, 906B, 232ms]
┌─────────────────────────┬──────────┬──────────┐
│ │ executed │ failed │
├─────────────────────────┼──────────┼──────────┤
│ iterations │ 1 │ 0 │
├─────────────────────────┼──────────┼──────────┤
│ requests │ 5 │ 0 │
├─────────────────────────┼──────────┼──────────┤
│ test-scripts │ 0 │ 0 │
├─────────────────────────┼──────────┼──────────┤
│ prerequest-scripts │ 0 │ 0 │
├─────────────────────────┼──────────┼──────────┤
│ assertions │ 0 │ 0 │
├─────────────────────────┴──────────┴──────────┤
│ total run duration: 2s │
├───────────────────────────────────────────────┤
│ total data received: 0B (approx) │
├───────────────────────────────────────────────┤
│ average response time: 379ms │
└───────────────────────────────────────────────┘
[f5-newman-build-5-2018-04-05-02-22-05] run completed in 5s, 859.146 ms
[snops@f5-super-netops] [~/f5-automation-labs/jenkins/f5-newman-build] $ f5-newman-wrapper f5-newman-build-1
[f5-newman-build-1-2018-04-05-02-22-19] starting run
[f5-newman-build-1-2018-04-05-02-22-19] [runCollection][Authenticate to BIG-IP] running...
newman
BIGIP_API_Authentication
❏ 1_Authenticate
↳ Authenticate and Obtain Token
POST https://10.1.1.10/mgmt/shared/authn/login [200 OK, 1.57KB, 419ms]
✓ [POST Response Code]=200
✓ [Populate Variable] bigip_token=XGX2SNMAGPCKDCLWAN7QLRWT7B
↳ Verify Authentication Works
GET https://10.1.1.10/mgmt/shared/authz/tokens/XGX2SNMAGPCKDCLWAN7QLRWT7B [200 OK, 1.39KB, 19ms]
✓ [GET Response Code]=200
✓ [Current Value] token=XGX2SNMAGPCKDCLWAN7QLRWT7B
✓ [Check Value] token == XGX2SNMAGPCKDCLWAN7QLRWT7B
↳ Set Authentication Token Timeout
PATCH https://10.1.1.10/mgmt/shared/authz/tokens/XGX2SNMAGPCKDCLWAN7QLRWT7B [200 OK, 1.39KB, 52ms]
✓ [PATCH Response Code]=200
✓ [Current Value] timeout=1200
✓ [Check Value] timeout == 1200
┌─────────────────────────┬──────────┬──────────┐
│ │ executed │ failed │
├─────────────────────────┼──────────┼──────────┤
│ iterations │ 1 │ 0 │
├─────────────────────────┼──────────┼──────────┤
│ requests │ 3 │ 0 │
├─────────────────────────┼──────────┼──────────┤
│ test-scripts │ 3 │ 0 │
├─────────────────────────┼──────────┼──────────┤
│ prerequest-scripts │ 1 │ 0 │
├─────────────────────────┼──────────┼──────────┤
│ assertions │ 8 │ 0 │
├─────────────────────────┴──────────┴──────────┤
│ total run duration: 1085ms │
├───────────────────────────────────────────────┤
│ total data received: 1.72KB (approx) │
├───────────────────────────────────────────────┤
│ average response time: 163ms │
└───────────────────────────────────────────────┘
[f5-newman-build-1-2018-04-05-02-22-19] [runCollection][1 - Build a Basic LTM Config] running...
newman
f5-programmability-class-2
❏ 1 - Build a Basic LTM Config
↳ Step 1: Create a HTTP Monitor
POST https://10.1.1.10/mgmt/tm/ltm/monitor/http [200 OK, 1.48KB, 580ms]
↳ Step 2: Create a Pool
POST https://10.1.1.10/mgmt/tm/ltm/pool [200 OK, 1.72KB, 242ms]
↳ Step 3: Create a HTTP Profile
POST https://10.1.1.10/mgmt/tm/ltm/profile/http [200 OK, 2.12KB, 386ms]
↳ Step 4: Create a TCP Profile
POST https://10.1.1.10/mgmt/tm/ltm/profile/tcp [200 OK, 2.77KB, 372ms]
↳ Step 5: Create a Virtual Server
POST https://10.1.1.10/mgmt/tm/ltm/virtual [200 OK, 2.06KB, 374ms]
┌─────────────────────────┬──────────┬──────────┐
│ │ executed │ failed │
├─────────────────────────┼──────────┼──────────┤
│ iterations │ 1 │ 0 │
├─────────────────────────┼──────────┼──────────┤
│ requests │ 5 │ 0 │
├─────────────────────────┼──────────┼──────────┤
│ test-scripts │ 0 │ 0 │
├─────────────────────────┼──────────┼──────────┤
│ prerequest-scripts │ 0 │ 0 │
├─────────────────────────┼──────────┼──────────┤
│ assertions │ 0 │ 0 │
├─────────────────────────┴──────────┴──────────┤
│ total run duration: 2.1s │
├───────────────────────────────────────────────┤
│ total data received: 5.72KB (approx) │
├───────────────────────────────────────────────┤
│ average response time: 390ms │
└───────────────────────────────────────────────┘
[f5-newman-build-1-2018-04-05-02-22-19] run completed in 6s, 923.691 ms
[snops@f5-super-netops] [~/f5-automation-labs/jenkins/f5-newman-build] $ f5-newman-wrapper f5-newman-build-2
[f5-newman-build-2-2018-04-05-02-23-11] starting run
[f5-newman-build-2-2018-04-05-02-23-11] [runCollection][Authenticate to BIG-IP] running...
newman
BIGIP_API_Authentication
❏ 1_Authenticate
↳ Authenticate and Obtain Token
POST https://10.1.1.10/mgmt/shared/authn/login [200 OK, 1.57KB, 434ms]
✓ [POST Response Code]=200
✓ [Populate Variable] bigip_token=TQHRS3AL5NWBXRAVJ5QDFXFAPR
↳ Verify Authentication Works
GET https://10.1.1.10/mgmt/shared/authz/tokens/TQHRS3AL5NWBXRAVJ5QDFXFAPR [200 OK, 1.39KB, 20ms]
✓ [GET Response Code]=200
✓ [Current Value] token=TQHRS3AL5NWBXRAVJ5QDFXFAPR
✓ [Check Value] token == TQHRS3AL5NWBXRAVJ5QDFXFAPR
↳ Set Authentication Token Timeout
PATCH https://10.1.1.10/mgmt/shared/authz/tokens/TQHRS3AL5NWBXRAVJ5QDFXFAPR [200 OK, 1.39KB, 61ms]
✓ [PATCH Response Code]=200
✓ [Current Value] timeout=1200
✓ [Check Value] timeout == 1200
┌─────────────────────────┬──────────┬──────────┐
│ │ executed │ failed │
├─────────────────────────┼──────────┼──────────┤
│ iterations │ 1 │ 0 │
├─────────────────────────┼──────────┼──────────┤
│ requests │ 3 │ 0 │
├─────────────────────────┼──────────┼──────────┤
│ test-scripts │ 3 │ 0 │
├─────────────────────────┼──────────┼──────────┤
│ prerequest-scripts │ 1 │ 0 │
├─────────────────────────┼──────────┼──────────┤
│ assertions │ 8 │ 0 │
├─────────────────────────┴──────────┴──────────┤
│ total run duration: 1127ms │
├───────────────────────────────────────────────┤
│ total data received: 1.72KB (approx) │
├───────────────────────────────────────────────┤
│ average response time: 171ms │
└───────────────────────────────────────────────┘
[f5-newman-build-2-2018-04-05-02-23-11] [runCollection][2 - Add Members to LTM Config] running...
newman
f5-programmability-class-2
❏ 2 - Add Members to LTM Config
↳ Step 1: Add Members to Pool
PATCH https://10.1.1.10/mgmt/tm/ltm/pool/module_3_pool [400 Bad Request, 1.05KB, 323ms]
┌─────────────────────────┬──────────┬──────────┐
│ │ executed │ failed │
├─────────────────────────┼──────────┼──────────┤
│ iterations │ 1 │ 0 │
├─────────────────────────┼──────────┼──────────┤
│ requests │ 1 │ 0 │
├─────────────────────────┼──────────┼──────────┤
│ test-scripts │ 0 │ 0 │
├─────────────────────────┼──────────┼──────────┤
│ prerequest-scripts │ 0 │ 0 │
├─────────────────────────┼──────────┼──────────┤
│ assertions │ 0 │ 0 │
├─────────────────────────┴──────────┴──────────┤
│ total run duration: 365ms │
├───────────────────────────────────────────────┤
│ total data received: 192B (approx) │
├───────────────────────────────────────────────┤
│ average response time: 323ms │
└───────────────────────────────────────────────┘
[f5-newman-build-2-2018-04-05-02-23-11] run completed in 4s, 309.677 ms
can you get me a cat of newman-2, im going to see in a diff if there is something messy here.
[snops@f5-super-netops] [~/f5-automation-labs/jenkins/f5-newman-build] $ cat f5-newman-build-2
{
"name":"f5-newman-build-2",
"description":"Execute a chained workflow that authenticates to a BIG-IP and builds configuration",
"globalEnvVars":"/home/snops/f5-postman-workflows/framework/f5-postman-workflows.postman_globals.json",
"globalOptions": {
"insecure":true,
"reporters":["cli"]
},
"globalVars": {
"bigip_mgmt": "10.1.1.10",
"bigip_username":"admin",
"bigip_password":"admin",
"bigip_partition":"Common",
"bigip_pool_name":"module_3_pool",
"bigip_pool_member":"10.1.10.101:8002",
"bigip_object_state":"user-up",
"bigip_object_session":"user-enabled",
"bigip_vs_name":"module_3_vs",
"bigip_vs_destination":"10.1.20.121:80",
"bigip_node_name":"10.1.10.101",
"bigip_http_monitor":"module_3_http_monitor",
"bigip_http_profile":"module_3_http",
"bigip_tcp_profile":"module_3_tcp_clientside"
},
"workflow": [
{
"name":"Authenticate to BIG-IP",
"options": {
"collection":"/home/snops/f5-postman-workflows/collections/BIG_IP/BIGIP_API_Authentication.postman_collection.json",
"folder":"1_Authenticate"
}
},
{
"name":"2 - Add Members to LTM Config",
"skip":false,
"options": {
"collection":"/home/snops/f5-automation-labs/postman_collections/f5-programmability-class-2.postman_collection.json",
"folder":"2 - Add Members to LTM Config"
}
}
]
}
ok pulled yours and compared with whats in the repo, everything matches, at this point you might try just restarting bigip-a othewise we could jump into rest logs, its seeming like something might just be up with your bigip though, this is the first time ive seen this happen
Hi Jon,
So I've restarted with an entirely new Ravello lab build today. Now I'm having trouble getting the 'f5-newman-build-1' to build the virtual server!
Note: I am restoring both Big-IP A and B using the module3 UCS file and 'no-license'
Here's the output from the newman wrapper:
[f5-newman-build-1-2018-04-05-23-16-52] [runCollection][1 - Build a Basic LTM Config] running...
newman
f5-programmability-class-2
❏ 1 - Build a Basic LTM Config
↳ Step 1: Create a HTTP Monitor
POST https://10.1.1.10/mgmt/tm/ltm/monitor/http [200 OK, 1.48KB, 443ms]
↳ Step 2: Create a Pool
POST https://10.1.1.10/mgmt/tm/ltm/pool [200 OK, 1.72KB, 279ms]
↳ Step 3: Create a HTTP Profile
POST https://10.1.1.10/mgmt/tm/ltm/profile/http [200 OK, 2.12KB, 388ms]
↳ Step 4: Create a TCP Profile
POST https://10.1.1.10/mgmt/tm/ltm/profile/tcp [200 OK, 2.77KB, 393ms]
↳ Step 5: Create a Virtual Server
POST https://10.1.1.10/mgmt/tm/ltm/virtual [400 Bad Request, 1.13KB, 283ms]
┌─────────────────────────┬──────────┬──────────┐
│ │ executed │ failed │
├─────────────────────────┼──────────┼──────────┤
│ iterations │ 1 │ 0 │
├─────────────────────────┼──────────┼──────────┤
│ requests │ 5 │ 0 │
├─────────────────────────┼──────────┼──────────┤
│ test-scripts │ 0 │ 0 │
├─────────────────────────┼──────────┼──────────┤
│ prerequest-scripts │ 0 │ 0 │
├─────────────────────────┼──────────┼──────────┤
│ assertions │ 0 │ 0 │
├─────────────────────────┴──────────┴──────────┤
│ total run duration: 1900ms │
├───────────────────────────────────────────────┤
│ total data received: 4.81KB (approx) │
├───────────────────────────────────────────────┤
│ average response time: 357ms │
└───────────────────────────────────────────────┘
[f5-newman-build-1-2018-04-05-23-16-52] run completed in 6s, 112.639 ms
This might need a bit more internal work. Is anybody else in the community (a) doing the Super-Netops labs and (b) getting these strange '400 Bad Requests'? Surely, I can't be the only one.
Just did a:
- bigstart restart' on Bigip-a
- ran the newman-build-5 script to cleanup
- ran the newman-build-1 script
Same results... a 400 on the creation of the virtual server.
Just bumping. Still keen to know if there are any present issues. It should be easy enough to replicate these 400 errors restoring the Module3.ucs and working through class 2.