From 23aa69bdc00a796949fa3e9f2251f1490293a52d Mon Sep 17 00:00:00 2001 From: Kevin Reynolds Date: Wed, 1 May 2024 11:39:02 -0400 Subject: [PATCH] overview --- cloudapp/app/app.py | 4 +++ labapp/app/app.py | 21 +++++++++++++++ labapp/app/markdown/overview.md | 46 +++++++++++++++++++++------------ 3 files changed, 55 insertions(+), 16 deletions(-) diff --git a/cloudapp/app/app.py b/cloudapp/app/app.py index 7fc40d3..49855cf 100644 --- a/cloudapp/app/app.py +++ b/cloudapp/app/app.py @@ -78,6 +78,10 @@ def echo_html(): } return render_template('pretty_echo.html', request_env=app.config['site'], info=info, request_headers=headers, request_data=data) + @app.route('/foo/', methods=['GET']) + def ex_test(): + return jsonify({'info': 'bar'}) + return app app = create_app() diff --git a/labapp/app/app.py b/labapp/app/app.py index 8b6c795..a615dad 100644 --- a/labapp/app/app.py +++ b/labapp/app/app.py @@ -195,6 +195,27 @@ def score(): ns=ns ) +@app.route('/_test1') +def ex_test(): + """Example test""" + try: + url = f"https://foo.{app.config['base_url']}/" + data = cloudapp_fetch(url, 5, 'info', 'bar') + return jsonify(status='success', data=data) + except (LabException, requests.RequestException, ValueError) as e: + return jsonify(status='fail', error=str(e)) + +@app.route('/_test2') +def ex_test(): + """Example test""" + try: + url = f"https://bar.{app.config['base_url']}/" + data = cloudapp_fetch(url, 5, 'info', 'foo') + return jsonify(status='success', data=data) + except (LabException, requests.RequestException, ValueError) as e: + return jsonify(status='fail', error=str(e)) + + @app.route('/_lb1') def lb_aws(): """Azure LB test""" diff --git a/labapp/app/markdown/overview.md b/labapp/app/markdown/overview.md index 9467dc7..df2b222 100644 --- a/labapp/app/markdown/overview.md +++ b/labapp/app/markdown/overview.md @@ -45,33 +45,47 @@ Remember while working through the lab, unless otherwise noted, the tests are di ## **Lab Exercises** -To complete the lab exercises, you will interact with a load balancer advertised from the Customer Edge in your UDF site from the [lab app](https://github.com/f5devcentral/f5xc-lab-mcn-practical/tree/main/labapp). +To complete the lab exercises, you will interact with a load balancer advertised from the Customer Edge in your UDF site. +All requests will be made from this lab application. -Test button +#### **Test Criteria** +Exercises will specify thier success criteria. ```http -GET https://eph-ns.mcn-lab.f5demos.com/ HTTP/1.1 -Host: eph-ns.mcn-lab.f5demos.com +GET https://foo.f5demos.com/ HTTP/1.1 { - "env": "Azure", - "info": { - "method": "GET", - "path": "/", - "url": "https://eph-ns.mcn-lab.f5demos.com" - }, - "request_headers": { - "Host": "https://eph-ns.mcn-lab.f5demos.com", - "User-Agent": "curl/8.4.0", - "X-Request-Id": "9cff4a3d-29e1-458e-b62e-3192e8398e14" - } + "info": "bar" } ``` +In this example, the exercise's test will make a request to https://foo.f5demos.com. +The test will succeed if the response contains the ``JSON`` response ``{ "info": "bar" }``. + +Here's an example test to try. + +
+ +
+
+ + +#### **Other Tools** + +``curl`` and ``jq`` are provided on the UDF "Runner" instance. + +curl + + +Note that responses displayed in exercise tests are truncated for readibility. + -``curl`` and ``jq`` are provided on the UDF "Runner" instance.