### Install Dependencies and Run MCPServerMicroservice with uv Source: https://github.com/tmforum-oda/oda-canvas/blob/main/source/tmf-services/MCP_Resource_Inventory/README.md This snippet demonstrates how to install uv, navigate to the project directory, synchronize dependencies, copy environment configuration, and run API tests or start the MCP server using uv commands. It is specific to a PowerShell environment. ```powershell # 1. Install uv if you haven't already powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex" # 2. Navigate to project directory cd "c:\Dev\tmforum-oda\oda-canvas\source\tmf-services\TMF639_Resource_Inventory\MCPServerMicroservice" # 3. Install dependencies uv sync # 4. Copy configuration template Copy-Item ".env.example" ".env" # 5. Run API tests uv run python test_resource_inventory_api.py # 6. Start the MCP server uv run python resource_inventory_mcp_server.py ``` -------------------------------- ### Install Javascript Kubernetes Client Source: https://github.com/tmforum-oda/oda-canvas/blob/main/source/utilities/canvas-log-viewer/node_modules/@kubernetes/client-node/README.md This command installs the Kubernetes client for Node.js using npm. It is a prerequisite for using the provided JavaScript examples. ```console npm install @kubernetes/client-node ``` -------------------------------- ### Start MCP Server Script Source: https://github.com/tmforum-oda/oda-canvas/blob/main/source/tmf-services/MCP_Resource_Inventory/SETUP_COMPLETE.md Powershell script to navigate to the MCP server directory, activate the virtual environment, and start the resource inventory MCP server. It requires the transport protocol to be specified. ```powershell cd "c:\Dev\tmforum-oda\oda-canvas\source\tmf-services\MCP_Resource_Inventory" .\.venv\Scripts\Activate.ps1 python resource_inventory_mcp_server.py --transport=stdio ``` -------------------------------- ### YAML Example: Maintenance Window Configuration Source: https://github.com/tmforum-oda/oda-canvas/blob/main/source/operators/pdb-management/docs/TECHNICAL_DOCUMENTATION.md Provides a YAML example of configuring maintenance windows, specifying start time, end time, timezone, and days of the week during which PDB enforcement is suspended. ```yaml maintenanceWindows: - start: "02:00" end: "04:00" timezone: "UTC" daysOfWeek: [0, 6] # Sunday, Saturday ``` -------------------------------- ### Initialize Caseless Object Wrapper (JavaScript) Source: https://github.com/tmforum-oda/oda-canvas/blob/main/source/utilities/canvas-log-viewer/node_modules/caseless/README.md Demonstrates how to initialize the Caseless library by wrapping an existing object. This setup is common for subsequent operations like setting and getting properties. ```javascript var headers = {} , c = caseless(headers) ; c.set('a-Header', 'asdf') c.get('a-header') === 'asdf' ``` -------------------------------- ### Install GKE Gcloud Auth Plugin (Debian/Ubuntu Bash) Source: https://github.com/tmforum-oda/oda-canvas/blob/main/devcontainer.md Installs the Google Kubernetes Engine (GKE) gcloud authentication plugin using apt-get. This plugin is necessary for authenticating with GKE clusters via the gcloud CLI. ```bash sudo apt-get update && sudo apt-get install google-cloud-sdk-gke-gcloud-auth-plugin ``` -------------------------------- ### Helm Chart Operations (JavaScript) Source: https://github.com/tmforum-oda/oda-canvas/blob/main/source/tmf-services/MCP_Resource_Inventory/SETUP_COMPLETE.md JavaScript code snippets demonstrating how to interact with Helm charts using the integrated MCP tools. It shows searching for charts and installing a TM Forum component. ```javascript // Search for components await helm_search_charts({search_term: "productcatalog"}) // Install TM Forum component await helm_install_tmforum_component({ component_name: "productcatalogmanagement", namespace: "components" }) ``` -------------------------------- ### Install Istio Components with Helm Source: https://github.com/tmforum-oda/oda-canvas/blob/main/installation/README.md This sequence of commands installs Istio, a service mesh, using Helm. It adds the Istio Helm repository, updates local repository cache, creates the `istio-system` namespace, installs the `istio-base` and `istiod` components, creates the `istio-ingress` namespace, labels it for Istio injection, and finally installs the Istio ingress gateway. ```bash helm repo add istio https://istio-release.storage.googleapis.com/charts helm repo update kubectl create namespace istio-system helm install istio-base istio/base -n istio-system helm install istiod istio/istiod -n istio-system --wait kubectl create namespace istio-ingress kubectl label namespace istio-ingress istio-injection=enabled helm install istio-ingress istio/gateway -n istio-ingress --set labels.app=istio-ingress --set labels.istio=ingressgateway --wait ``` -------------------------------- ### Install Project Dependencies Source: https://github.com/tmforum-oda/oda-canvas/blob/main/source/tmf-services/MCP_Resource_Inventory/README.md Installs the project dependencies, including the API wrapper, using the `uv pip install -e .` command. This is essential for setting up the development environment and resolving import errors. ```powershell uv pip install -e . ``` -------------------------------- ### Install npm Dependencies Source: https://github.com/tmforum-oda/oda-canvas/blob/main/feature-definition-and-test-kit/PDB-TEST-README.md Installs the necessary Node.js dependencies for the BDD test kit. This command should be run from the 'feature-definition-and-test-kit' directory. ```bash cd feature-definition-and-test-kit npm install ``` -------------------------------- ### Install TM Forum Component with Helm Source: https://github.com/tmforum-oda/oda-canvas/blob/main/source/tmf-services/MCP_Resource_Inventory/README.md Installs a TM Forum ODA Component from the reference repository using Helm. Accepts component name, optional release name, namespace, custom values, and version. Requires Helm to be installed and configured. ```javascript await helm_install_tmforum_component({ component_name: "productcatalogmanagement", namespace: "components" }) ``` -------------------------------- ### IdentityConfig Resource Example Source: https://github.com/tmforum-oda/oda-canvas/blob/main/source/operators/identity-config/README-PermissionSpecificationSet.md Example YAML demonstrating how to configure the IdentityConfig resource to enable support for both partyRoleAPI and permissionSpecificationSetAPI. ```APIDOC ## IdentityConfig Resource Example ### Description This example shows how to configure an IdentityConfig resource to enable dynamic party roles and permission specifications by specifying the respective API details. ### Method N/A (Resource Configuration) ### Endpoint N/A (Resource Configuration) ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body ```yaml apiVersion: oda.tmforum.org/v1 kind: IdentityConfig metadata: name: my-component spec: canvasSystemRole: CanvasRole # For dynamic party roles partyRoleAPI: implementation: my-component-service path: /my-component/partyRoleManagement/v4 port: 8080 # For dynamic permission specifications permissionSpecificationSetAPI: implementation: my-component-service path: /my-component/rolesAndPermissionsManagement/v5 port: 8080 ``` ### Request Example N/A ### Response N/A (Resource Configuration) ``` -------------------------------- ### Helm Install TM Forum Component Source: https://github.com/tmforum-oda/oda-canvas/blob/main/source/tmf-services/MCP_Resource_Inventory/README.md Installs a TM Forum ODA Component from the reference repository using Helm. Allows customization of release name, namespace, values, and version. ```APIDOC ## helm_install_tmforum_component ### Description Install a TM Forum ODA Component from the reference repository. ### Method Not specified (assumed internal function call based on example) ### Endpoint Not applicable (function call) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **component_name** (string) - Required - Name of the TM Forum component (e.g., "productcatalogmanagement") - **release_name** (string) - Optional - Custom release name - **namespace** (string) - Optional - Target namespace - **values** (object) - Optional - Custom values to override - **version** (string) - Optional - Component version ### Request Example ```javascript await helm_install_tmforum_component({ component_name: "productcatalogmanagement", namespace: "components" }) ``` ### Response #### Success Response (200) Details not specified. #### Response Example None provided. ``` -------------------------------- ### Open Project in Visual Studio Code (Bash) Source: https://github.com/tmforum-oda/oda-canvas/blob/main/devcontainer.md Navigates into the cloned ODA Canvas directory and opens it in Visual Studio Code. This command assumes VS Code is installed and configured in the system's PATH. ```bash cd oda-canvas code . ``` -------------------------------- ### Install ODA Canvas Helm Chart Source: https://github.com/tmforum-oda/oda-canvas/blob/main/installation/README.md This command installs the ODA Canvas application using its Helm chart. It specifies the release name `canvas`, installs it into the `canvas` namespace (creating it if it doesn't exist), and demonstrates how to disable the HashiCorp Vault component by setting `canvas-vault.enabled` to `false` via the command line. ```bash helm install canvas oda-canvas/canvas-oda -n canvas --create-namespace --set=canvas-vault.enabled=false ``` -------------------------------- ### Install stream-buffers Source: https://github.com/tmforum-oda/oda-canvas/blob/main/source/utilities/canvas-log-viewer/node_modules/stream-buffers/README.md Installs the 'stream-buffers' package using npm. This is the initial step to use the library in your Node.js project. ```bash npm install stream-buffers --save ``` -------------------------------- ### Install Punycode.js via npm Source: https://github.com/tmforum-oda/oda-canvas/blob/main/source/utilities/canvas-log-viewer/node_modules/punycode/README.md Installs the Punycode.js library using npm. This command should be run in your project's root directory. ```bash npm install punycode --save ``` -------------------------------- ### Deploy ODA Canvas with Helm and Istio Source: https://github.com/tmforum-oda/oda-canvas/blob/main/installation/azure/README.md Installs the ODA Canvas using Helm charts, which includes Istio deployment. It creates a namespace 'oda' if it doesn't exist and ensures Istio sidecar injection is enabled for the namespace. ```bash helm install oda-canvas ./charts/oda-canvas -n oda --create-namespace ``` -------------------------------- ### Install tslib with bower Source: https://github.com/tmforum-oda/oda-canvas/blob/main/source/utilities/canvas-log-viewer/node_modules/tslib/README.md Instructions for installing the tslib library using bower, with version-specific commands for different TypeScript versions. ```bash # TypeScript 3.9.2 or later bower install tslib # TypeScript 3.8.4 or earlier bower install tslib@^1 # TypeScript 2.3.2 or earlier bower install tslib@1.6.1 ``` -------------------------------- ### Install tslib with yarn Source: https://github.com/tmforum-oda/oda-canvas/blob/main/source/utilities/canvas-log-viewer/node_modules/tslib/README.md Instructions for installing the tslib library using yarn, with version-specific commands for different TypeScript versions. ```bash # TypeScript 3.9.2 or later yarn add tslib # TypeScript 3.8.4 or earlier yarn add tslib@^1 # TypeScript 2.3.2 or earlier yarn add tslib@1.6.1 ``` -------------------------------- ### Install tslib with npm Source: https://github.com/tmforum-oda/oda-canvas/blob/main/source/utilities/canvas-log-viewer/node_modules/tslib/README.md Instructions for installing the tslib library using npm, with version-specific commands for different TypeScript versions. ```bash # TypeScript 3.9.2 or later npm install tslib # TypeScript 3.8.4 or earlier npm install tslib@^1 # TypeScript 2.3.2 or earlier npm install tslib@1.6.1 ``` -------------------------------- ### Install mime-db Package Source: https://github.com/tmforum-oda/oda-canvas/blob/main/source/utilities/canvas-log-viewer/node_modules/mime-db/README.md This command installs the mime-db package using npm, making the database and its associated utilities available in your Node.js project. ```bash npm install mime-db ``` -------------------------------- ### Install tslib with JSPM Source: https://github.com/tmforum-oda/oda-canvas/blob/main/source/utilities/canvas-log-viewer/node_modules/tslib/README.md Instructions for installing the tslib library using JSPM, with version-specific commands for different TypeScript versions. ```bash # TypeScript 3.9.2 or later jspm install tslib # TypeScript 3.8.4 or earlier jspm install tslib@^1 # TypeScript 2.3.2 or earlier jspm install tslib@1.6.1 ``` -------------------------------- ### Install JSONPath Plus using npm Source: https://github.com/tmforum-oda/oda-canvas/blob/main/source/utilities/canvas-log-viewer/node_modules/jsonpath-plus/README.md Installs the jsonpath-plus package using npm. This is the primary method for adding the library to a Node.js project. ```shell npm install jsonpath-plus ``` -------------------------------- ### Instrument Python Flask App for OTel Tracing Source: https://github.com/tmforum-oda/oda-canvas/blob/main/installation/azure/automated/automated_install_azure_README.md Provides an example of how to instrument a Python Flask application to send traces to an OpenTelemetry Collector. It includes installing necessary dependencies, configuring the tracer provider, and adding custom spans for business logic within API endpoints. ```python # app.py of your TMF component from flask import Flask from opentelemetry import trace from opentelemetry.sdk.trace import TracerProvider from opentelemetry.sdk.trace.export import BatchSpanProcessor from opentelemetry.exporter.otlp.proto.grpc.trace_exporter import OTLPSpanExporter from opentelemetry.instrumentation.flask import FlaskInstrumentor # Point to the OTel Collector service in your K8s cluster otlp_exporter = OTLPSpanExporter(endpoint="otel-collector.istio-system.svc.cluster.local:4317", insecure=True) trace.set_tracer_provider(TracerProvider()) trace.get_tracer_provider().add_span_processor(BatchSpanProcessor(otlp_exporter)) app = Flask(__name__) FlaskInstrumentor().instrument_app(app) # Automatically instrument Flask requests tracer = trace.get_tracer(__name__) @app.route('/product-catalog/v1/product') def get_products(): # Add custom spans for specific business logic with tracer.start_as_current_span("query_database_for_products") as db_span: db_span.set_attribute("db.system", "postgresql") products = [{"id": "123", "name": "5G Unlimited Plan"}] return products ``` -------------------------------- ### Example Trace with Unified Logging Source: https://github.com/tmforum-oda/oda-canvas/blob/main/source/operators/pdb-management/docs/TECHNICAL_DOCUMENTATION.md This Go code snippet illustrates a conceptual trace of the deployment reconciliation process, showing the sequence of operations. It highlights how unified logging context is included in all trace spans for complete observability. ```go // Example trace with unified logging deployment-reconcile ├── get-deployment ├── check-annotations ├── lookup-policies │ └── cache-lookup ├── resolve-configuration │ └── apply-enforcement └── manage-pdb ├── get-existing-pdb └── create-or-update-pdb ``` -------------------------------- ### Basic HTTP GET Request Source: https://github.com/tmforum-oda/oda-canvas/blob/main/source/utilities/canvas-log-viewer/node_modules/request/README.md Demonstrates a simple GET request to a URL using the 'request' library. It logs any errors, the status code, and the response body. This is a fundamental example of making an HTTP call. ```javascript const request = require('request'); request('http://www.google.com', function (error, response, body) { console.error('error:', error); // Print the error if one occurred console.log('statusCode:', response && response.statusCode); // Print the response status code if a response was received console.log('body:', body); // Print the HTML for the Google homepage. }); ``` -------------------------------- ### Check Test Dependencies with npm Source: https://github.com/tmforum-oda/oda-canvas/blob/main/feature-definition-and-test-kit/PDB-TEST-README.md Commands to verify the installation status of specific npm packages required for testing, such as @cucumber/cucumber and @kubernetes/client-node. Includes a command to install any missing dependencies. ```bash # Verify all required modules are installed npm ls @cucumber/cucumber npm ls @kubernetes/client-node # Check for missing dependencies npm install ``` -------------------------------- ### Helm Commands for ODA Component Management Source: https://github.com/tmforum-oda/oda-canvas/blob/main/source/tmf-services/MCP_Resource_Inventory/README.md This section outlines various Helm commands for managing ODA components within a Kubernetes environment. It covers searching for charts, listing installed releases, installing, upgrading, uninstalling, and getting the status of releases. It also includes managing Helm repositories. ```bash # Search for Helm charts helm_search_charts(search_term="productcatalog", repository="myrepo") # List installed Helm releases helm_list_releases(namespace="components") # Install a Helm chart helm_install_chart(release_name="my-component", chart_reference="myrepo/mychart", namespace="components", values={"replicaCount": 2}) # Upgrade an existing Helm release helm_upgrade_release(release_name="my-component", chart_reference="myrepo/mychart", values={"imageTag": "latest"}) # Uninstall a Helm release helm_uninstall_release(release_name="my-component", namespace="components") # Get detailed status of a Helm release helm_get_release_status(release_name="my-component", namespace="components") # Manage Helm repositories (add) helm_manage_repositories(action="add", repo_name="myrepo", repo_url="http://myrepo.com/charts") # Manage Helm repositories (list) helm_manage_repositories(action="list") ``` -------------------------------- ### Verify Integration Script Source: https://github.com/tmforum-oda/oda-canvas/blob/main/source/tmf-services/MCP_Resource_Inventory/SETUP_COMPLETE.md Powershell script to activate the virtual environment and run the integration verification script. This script checks for the detection of Helm tools and repository listing functionality. ```powershell .\.venv\Scripts\Activate.ps1 python verify_integration.py ``` -------------------------------- ### Setup Python Environment for Canvas Logs Source: https://github.com/tmforum-oda/oda-canvas/blob/main/source/utilities/canvas-log-viewer/python_alternative/README.md This snippet demonstrates how to set up a dedicated Python virtual environment for the Canvas Log Viewer. It installs necessary packages like 'rich' and 'timedinput', which are required for the viewer's functionality. It assumes a standard Python 3 installation. ```bash mkdir -p ~/.venv python3 -m venv ~/.venv/canvaslogs . ~/.venv/canvaslogs/bin/activate pip install rich timedinput ``` -------------------------------- ### Get Tarball Filenames Asynchronously with 'tar' Module Source: https://github.com/tmforum-oda/oda-canvas/blob/main/source/utilities/canvas-log-viewer/node_modules/tar/README.md An example function that lists the contents of a tarball and returns an array of filenames. It utilizes the 'tar.t' method with an `onReadEntry` callback to collect the paths of each entry. ```javascript const getEntryFilenames = async tarballFilename => { const filenames = [] await tar.t({ file: tarballFilename, onReadEntry: entry => filenames.push(entry.path), }) return filenames } ``` -------------------------------- ### Making HTTP Requests with Options Source: https://github.com/tmforum-oda/oda-canvas/blob/main/source/utilities/canvas-log-viewer/node_modules/request/README.md Demonstrates how to use the `request` function with various options to configure HTTP requests. ```APIDOC ## Making HTTP Requests ### Description This section details the parameters and options available for configuring HTTP requests using the `request` library. ### Method `request(options, callback)` ### Endpoint N/A (Library function) ### Parameters #### General Options - **uri** || **url** (string | object) - Required - The fully qualified URI or a parsed URL object. - **baseUrl** (string) - Optional - A base URL to prepend to relative URIs. - **method** (string) - Optional - The HTTP method (e.g., 'GET', 'POST', 'PUT', 'DELETE'). Defaults to 'GET'. - **headers** (object) - Optional - An object containing HTTP headers. Defaults to `{}`. #### Query String Options - **qs** (object) - Optional - An object containing query string values. - **qsParseOptions** (object) - Optional - Options to pass to `qs.parse()` or `querystring.parse()`. - **qsStringifyOptions** (object) - Optional - Options to pass to `qs.stringify()` or `querystring.stringify()`. - **useQuerystring** (boolean) - Optional - Use `querystring` module instead of `qs` for stringifying/parsing. Defaults to `false`. #### Request Body Options - **body** (Buffer | string | Stream | object) - Optional - The entity body for PATCH, POST, and PUT requests. If `json` is true, this must be JSON-serializable. - **form** (object | string) - Optional - Sets `body` to a URL-encoded string and adds the `Content-type` header. - **formData** (object) - Optional - Data for a `multipart/form-data` request. - **multipart** (array | object) - Optional - An array of objects for a `multipart/related` request, or an object for chunked transfer encoding. - **json** (boolean | any) - Optional - Enables JSON parsing/stringifying for the request body and response. If `true`, sets `Content-type: application/json` and parses the response as JSON. - **jsonReviver** (function) - Optional - A reviver function for `JSON.parse()` when parsing JSON responses. - **jsonReplacer** (function) - Optional - A replacer function for `JSON.stringify()` when stringifying JSON request bodies. #### Authentication Options - **auth** (object) - Optional - Authentication hash with `user`, `pass`, and `sendImmediately` properties. - **oauth** (object) - Optional - Options for OAuth HMAC-SHA1 signing. - **hawk** (object) - Optional - Options for Hawk signing. - **aws** (object) - Optional - AWS signing information (key, secret, session, bucket, sign_version, service). ### Request Example ```javascript const request = require('request'); // Simple GET request request('https://example.com/api/users', function (error, response, body) { if (!error && response.statusCode == 200) { console.log(body); } }); // POST request with JSON body request({ uri: 'https://example.com/api/posts', method: 'POST', json: { title: 'New Post', body: 'This is the content.' } }, function(error, response, body) { // handle response }); ``` ### Response #### Success Response (200) - **body** (string | object | Buffer) - The response body. - **response** (object) - The response object from the HTTP request. - **error** (Error) - An error object if the request failed. #### Response Example ```json { "userId": 1, "id": 1, "title": "sunt aut facere repellat provident occaecati excepturi optio reprehenderit", "body": "quia et suscipit\nsuscipit recusandae consequuntur expedita et cum\nreprehenderit molestiae ut ut \nquas totam\nnostrum rerum est autem sunt rem eveniet architecto" } ``` ``` -------------------------------- ### JavaScript: Inspecting cookie jar with request Source: https://github.com/tmforum-oda/oda-canvas/blob/main/source/utilities/canvas-log-viewer/node_modules/request/README.md Provides examples of how to retrieve cookie information from a cookie jar after a request has been made. It shows how to get the cookie string and a list of individual cookie objects. ```javascript const j = request.jar() request({url: 'http://www.google.com', jar: j}, function () { const cookie_string = j.getCookieString(url); // "key1=value1; key2=value2; ..." const cookies = j.getCookies(url); // [{key: 'key1', value: 'value1', domain: "www.google.com", ...}, ...] }) ``` -------------------------------- ### Get AKS Credentials and List Nodes (kubectl) Source: https://github.com/tmforum-oda/oda-canvas/blob/main/installation/azure/README.md These commands are used to retrieve the credentials for accessing your AKS cluster and then list the nodes within the cluster. This verifies that the cluster is operational and accessible. ```bash az aks get-credentials --resource-group --name ``` ```bash kubectl get nodes ``` -------------------------------- ### Clone Product Catalog Repository Source: https://github.com/tmforum-oda/oda-canvas/blob/main/installation/azure/README.md Clones the TMF620 Product Catalog repository from GitHub and navigates into the cloned directory. This is the initial step for setting up the service. ```bash git clone https://github.com/tmforum-oda/TMF620_Product_Catalog.git cd TMF620_Product_Catalog ``` -------------------------------- ### Node.js and npm Version Check Source: https://github.com/tmforum-oda/oda-canvas/blob/main/feature-definition-and-test-kit/PDB-TEST-README.md Verify that Node.js and npm are installed and meet the minimum version requirements (Node.js v14+, npm v6+) for running the Cucumber BDD tests. ```bash node --version npm --version ``` -------------------------------- ### Troubleshooting - Common Issues Source: https://github.com/tmforum-oda/oda-canvas/blob/main/source/tmf-services/MCP_Resource_Inventory/README.md Lists common issues encountered during API usage, such as connection refused and SSL certificate errors, with basic troubleshooting tips. ```APIDOC ## Troubleshooting - Common Issues ### Description Common issues and their potential solutions: 1. **Connection Refused**: Ensure the TMF639 API service is running on the expected port 2. **SSL Certificate Errors**: The API wrapper disables SSL verification for development 3. **Import Errors**: Ensure all dependencies are installed with `uv pip install -e .` ``` -------------------------------- ### Apply Kubernetes Manifests for Product Catalog Source: https://github.com/tmforum-oda/oda-canvas/blob/main/installation/azure/README.md Applies the Kubernetes manifests to create the Product Catalog deployment and service. It first creates and labels the 'components' namespace for Istio injection, then applies the deployment and service YAML files. ```bash kubectl create namespace components kubectl label namespace components istio-injection=enabled kubectl apply -f tmf620-product-catalog-deployment.yaml kubectl apply -f tmf620-product-catalog-service.yaml ``` -------------------------------- ### Setup JSONPath Plus in Browser (ESM) Source: https://github.com/tmforum-oda/oda-canvas/blob/main/source/utilities/canvas-log-viewer/node_modules/jsonpath-plus/README.md Provides an example of using ES6 Module imports for JSONPath Plus in modern browsers. This requires setting the script type to 'module' and using the correct path to the ESM build file. ```html ``` -------------------------------- ### Convenience Methods Source: https://github.com/tmforum-oda/oda-canvas/blob/main/source/utilities/canvas-log-viewer/node_modules/request/README.md Overview of convenience methods provided by the request API, including creating default-configured request wrappers, shorthand HTTP methods, and cookie management utilities. ```APIDOC ## Convenience Methods ### Description Provides shorthand methods for common HTTP operations and utilities for managing requests and cookies. ### `request.defaults(options)` #### Description Returns a wrapper around the normal request API that defaults to the provided options. #### Notes - `request.defaults()` does not modify the global request API. - You can call `.defaults()` on a returned wrapper to add or override defaults. #### Example ```javascript // requests using baseRequest() will set the 'x-token' header const baseRequest = request.defaults({ headers: {'x-token': 'my-token'} }) // requests using specialRequest() will include the 'x-token' header set in // baseRequest and will also include the 'special' header const specialRequest = baseRequest.defaults({ headers: {special: 'special value'} }) ``` ### `request.METHOD()` #### Description HTTP method convenience functions that act like `request()` but with a default method set. #### Available Methods - `request.get()`: Defaults to `method: "GET"`. - `request.post()`: Defaults to `method: "POST"`. - `request.put()`: Defaults to `method: "PUT"`. - `request.patch()`: Defaults to `method: "PATCH"`. - `request.del()` / `request.delete()`: Defaults to `method: "DELETE"`. - `request.head()`: Defaults to `method: "HEAD"`. - `request.options()`: Defaults to `method: "OPTIONS"`. ### `request.cookie(string)` #### Description Function that creates a new cookie. #### Example ```javascript request.cookie('key1=value1'); ``` ### `request.jar()` #### Description Function that creates a new cookie jar. #### Example ```javascript request.jar(); ``` ``` -------------------------------- ### MCP Client Configuration (Claude Desktop) Source: https://github.com/tmforum-oda/oda-canvas/blob/main/source/tmf-services/MCP_Resource_Inventory/SETUP_COMPLETE.md JSON configuration for connecting a client, like Claude Desktop, to the TMF639 Resource Inventory MCP Server. It specifies the command to run, arguments, and the working directory for the server process. ```json { "mcpServers": { "tmf639-resource-inventory": { "command": "python", "args": ["resource_inventory_mcp_server.py"], "cwd": "c:/Dev/tmforum-oda/oda-canvas/source/tmf-services/MCP_Resource_Inventory" } } } ``` -------------------------------- ### Testing Product Catalog API (Bash) Source: https://github.com/tmforum-oda/oda-canvas/blob/main/installation/azure/README.md A cURL command to perform a GET request to the Product Catalog API endpoint through the Azure API Management gateway. This tests basic API accessibility. ```bash curl -X GET https:///product-catalog ``` -------------------------------- ### Browser Installation and Usage of object-hash (JavaScript) Source: https://github.com/tmforum-oda/oda-canvas/blob/main/source/utilities/canvas-log-viewer/node_modules/object-hash/readme.markdown Provides an example of how to include the object-hash library in an HTML file using a script tag and then use its `sha1` sugar method to hash a simple object in the browser's console. ```html ``` -------------------------------- ### Clone ODA Canvas Repository and Navigate Source: https://github.com/tmforum-oda/oda-canvas/blob/main/installation/azure/README.md Clones the ODA Canvas charts repository from GitHub and changes the directory to the cloned repository. This is the initial step for setting up the ODA Canvas. ```bash git clone https://github.com/tmforum-oda/oda-canvas-charts.git cd oda-canvas-charts ``` -------------------------------- ### Authenticated API Request (Bash) Source: https://github.com/tmforum-oda/oda-canvas/blob/main/installation/azure/README.md A cURL command demonstrating how to make an authenticated GET request to the Product Catalog API. It includes an 'Authorization' header with a JWT token obtained from Azure Entra ID. ```bash curl -H "Authorization: Bearer " https:///product-catalog ``` -------------------------------- ### Helm Command to Deploy PDB Operator Source: https://github.com/tmforum-oda/oda-canvas/blob/main/feature-definition-and-test-kit/PDB-TEST-README.md Demonstrates how to deploy or upgrade the PDB Management Operator using Helm, ensuring it is enabled within the Canvas installation. This is a solution for the 'Operator Not Found' issue. ```bash helm upgrade --install canvas-oda charts/canvas-oda \ --set pdb-management-operator.enabled=true ``` -------------------------------- ### Install asynckit using npm Source: https://github.com/tmforum-oda/oda-canvas/blob/main/source/utilities/canvas-log-viewer/node_modules/asynckit/README.md This command installs the asynckit library as a project dependency. It is typically used in Node.js projects to manage asynchronous operations. ```bash npm install --save asynckit ``` -------------------------------- ### Connect and Send Data with Isomorphic WebSocket Source: https://github.com/tmforum-oda/oda-canvas/blob/main/source/utilities/canvas-log-viewer/node_modules/isomorphic-ws/README.md Demonstrates how to establish a WebSocket connection, send data, and handle incoming messages and connection events using the isomorphic-ws library. This example is compatible with both Node.js and browser environments. It requires the 'isomorphic-ws' package to be installed. ```javascript const WebSocket = require('isomorphic-ws'); const ws = new WebSocket('wss://echo.websocket.org/'); ws.onopen = function open() { console.log('connected'); ws.send(Date.now()); }; ws.onclose = function close() { console.log('disconnected'); }; ws.onmessage = function incoming(data) { console.log(`Roundtrip time: ${Date.now() - data.data} ms`); setTimeout(function timeout() { ws.send(Date.now()); }, 500); }; ``` -------------------------------- ### Clone ODA Canvas Repository (Bash) Source: https://github.com/tmforum-oda/oda-canvas/blob/main/devcontainer.md Clones the ODA Canvas project repository from GitHub to a local machine. This is the initial step to obtain the project's source code. ```bash git clone https://github.com/your-username/oda-canvas.git ``` -------------------------------- ### Project Structure Source: https://github.com/tmforum-oda/oda-canvas/blob/main/source/tmf-services/MCP_Resource_Inventory/README.md Overview of the project directory structure for the TMF639 Resource Inventory MCPServerMicroservice. ```APIDOC ## Project Structure ### Description Directory structure for the TMF639 Resource Inventory MCPServerMicroservice: ``` TMF639_Resource_Inventory/MCPServerMicroservice/ ├── resource_inventory_api.py # API wrapper for TMF639 ├── resource_inventory_mcp_server.py # MCP Server implementation ├── test_resource_inventory_api.py # Test suite ├── pyproject.toml # Project configuration ├── .python-version # Python version specification ├── .env # Environment variables └── README.md # This file ``` ``` -------------------------------- ### Verify PDB Operator Status and Logs Source: https://github.com/tmforum-oda/oda-canvas/blob/main/feature-definition-and-test-kit/PDB-TEST-README.md Commands to check the PDB operator's deployment status, view its recent logs, and confirm the installation of Custom Resource Definitions (CRDs) related to availability. ```bash kubectl get deployment -n canvas canvas-pdb-management-operator kubectl logs -n canvas -l app.kubernetes.io/name=pdb-management --tail=20 kubectl get crd | grep availability ``` -------------------------------- ### Execute Development Tasks with PowerShell Script Source: https://github.com/tmforum-oda/oda-canvas/blob/main/source/tmf-services/MCP_Resource_Inventory/README.md This snippet details the usage of the `dev.ps1` PowerShell script for managing the development environment. It includes commands for displaying help, setting up the environment, running tests, starting the MCP server, and performing code checks (format and lint). ```powershell # Show available commands .\dev.ps1 help # Setup development environment .\dev.ps1 setup # Run tests .\dev.ps1 test # Start MCP server .\dev.ps1 run # Format and lint code .\dev.ps1 check ``` -------------------------------- ### Get Client IP Address from WebSocket Connection (Node.js) Source: https://github.com/tmforum-oda/oda-canvas/blob/main/source/utilities/canvas-log-viewer/node_modules/ws/README.md This Node.js example shows how to retrieve the remote IP address of a connected WebSocket client. It accesses `req.socket.remoteAddress` directly from the upgrade request. An alternative approach for servers behind proxies using the `X-Forwarded-For` header is also provided. ```javascript import { WebSocketServer } from 'ws'; const wss = new WebSocketServer({ port: 8080 }); wss.on('connection', function connection(ws, req) { const ip = req.socket.remoteAddress; ws.on('error', console.error); }); ``` ```javascript wss.on('connection', function connection(ws, req) { const ip = req.headers['x-forwarded-for'].split(',')[0].trim(); ws.on('error', console.error); }); ``` -------------------------------- ### Example: View All Component Logs Source: https://github.com/tmforum-oda/oda-canvas/blob/main/source/utilities/canvas-log-viewer/python_alternative/README.md This command demonstrates the basic usage of the Canvas Log Viewer to display the complete logs for all 'Component-Operator' logs. It's the simplest way to start viewing logs without any filters. ```bash kubectl canvaslogs comp ``` -------------------------------- ### Build and Push Product Catalog Docker Image Source: https://github.com/tmforum-oda/oda-canvas/blob/main/installation/azure/README.md Builds a Docker image for the TMF620 Product Catalog component and pushes it to a container registry. This step is necessary before deploying the Product Catalog to Kubernetes. ```bash # Build the Docker image docker build -t tmf620-product-catalog . # Push the image to a container registry (e.g., Azure Container Registry) docker tag tmf620-product-catalog .azurecr.io/tmf620-product-catalog:latest docker push .azurecr.io/tmf620-product-catalog:latest ``` -------------------------------- ### JavaScript Debug Logging Example Source: https://github.com/tmforum-oda/oda-canvas/blob/main/feature-definition-and-test-kit/PDB-TEST-README.md Illustrates how to add `console.log` statements within JavaScript step definitions to aid in debugging test scenarios. This helps in inspecting variable values and execution flow during test runs. ```javascript // Add console.log statements for debugging console.log("Creating deployment:", deploymentName); console.log("PDB response:", pdb); ``` -------------------------------- ### Run PDB BDD Tests in GitHub Actions Workflow Source: https://github.com/tmforum-oda/oda-canvas/blob/main/feature-definition-and-test-kit/PDB-TEST-README.md This GitHub Actions workflow snippet installs dependencies and runs PDB BDD tests. It conditionally executes full local tests only if a Kubernetes cluster is detected, optimizing CI performance. ```yaml - name: Run PDB BDD Tests run: | cd feature-definition-and-test-kit npm install npm run test:pdb:dry-run # Only run full tests if cluster is available if kubectl cluster-info > /dev/null 2>&1; then npm run test:pdb:local fi ``` -------------------------------- ### Grant AKS Managed Identity Access to Key Vault (Azure CLI) Source: https://github.com/tmforum-oda/oda-canvas/blob/main/installation/azure/README.md Command to grant specific permissions (get, list secrets) to the AKS cluster's managed identity on an Azure Key Vault. This allows the AKS cluster to retrieve secrets, such as the database connection string. ```bash az keyvault set-policy -n --object-id --secret-permissions get list ``` -------------------------------- ### Clone ODA Canvas Repository Source: https://github.com/tmforum-oda/oda-canvas/blob/main/installation/azure/README.md Clones the TM Forum ODA Canvas repository from GitHub. This is a prerequisite for deploying the ODA Canvas and its components. ```bash git clone https://github.com/tmforum-oda/oda-canvas.git ``` -------------------------------- ### Example Signing String: Header List Parameterization (Conceptual) Source: https://github.com/tmforum-oda/oda-canvas/blob/main/source/utilities/canvas-log-viewer/node_modules/http-signature/http_signing.md Illustrates the signing string composition when a specific list of headers, including '(request-target)', 'date', 'content-type', and 'digest', are explicitly included. Each header is formatted according to the rules and separated by newlines. ```text (request-target) post /foo date: Tue, 07 Jun 2011 20:51:35 GMT content-type: application/json digest: SHA-256=Base64(SHA256(Body)) ``` -------------------------------- ### Encode ASN.1 Sequence with Boolean using node-asn1 Source: https://github.com/tmforum-oda/oda-canvas/blob/main/source/utilities/canvas-log-viewer/node_modules/asn1/README.md This example illustrates how to encode an ASN.1 sequence with a boolean value using the node-asn1 library. It employs the Ber.Writer class to construct the BER-encoded buffer. The process involves starting a sequence, writing a boolean, and ending the sequence, after which the resulting buffer is logged. The Ber module is a prerequisite. ```javascript var Ber = require('asn1').Ber; var writer = new Ber.Writer(); writer.startSequence(); writer.writeBoolean(true); writer.endSequence(); console.log(writer.buffer); ``` -------------------------------- ### Deploy ODA Canvas Foundation with Helm Source: https://github.com/tmforum-oda/oda-canvas/blob/main/installation/azure/automated/automated_install_azure_README.md This Helm command deploys the ODA Canvas foundation, including Istio, into an AKS cluster. It assumes the 'oda-canvas-charts' repository is cloned and installs the chart into the 'oda' namespace, creating it if it doesn't exist. It also includes a verification step to check Istio pods. ```bash echo "Deploying ODA Canvas foundation with Istio..." # Assumes you have the oda-canvas-charts repository cloned helm install oda-canvas ./charts/oda-canvas -n oda --create-namespace # Verify Istio deployment kubectl get pods -n istio-system ``` -------------------------------- ### JS-YAML CLI Usage Example Source: https://github.com/tmforum-oda/oda-canvas/blob/main/source/utilities/canvas-log-viewer/node_modules/js-yaml/README.md Demonstrates the command-line interface usage for js-yaml. It shows how to specify a YAML file and available optional arguments for help, version, compact error display, and trace. ```bash usage: js-yaml [-h] [-v] [-c] [-t] file Positional arguments: file File with YAML document(s) Optional arguments: -h, --help Show this help message and exit. -v, --version Show program's version number and exit. -c, --compact Display errors in compact mode -t, --trace Show stack trace on error ```