Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 2, 2025

Application failed to start due to missing backend controller modules and incorrect frontend serve command syntax.

Backend Fixes

Missing modules: Created controller modules imported by app.py but never defined:

  • controllers/logical_router.py
  • controllers/acl.py
  • controllers/load_balancer.py
  • controllers/port.py
  • utils/validators.py

OVN command issues: Fixed non-existent OVN commands (lr-get, lb-get, lsp-get) by using list-based lookups:

def get_logical_router(self, router_id: str) -> Optional[Dict]:
    routers = self.get_logical_routers()
    for router in routers:
        if router.get('name') == router_id or router.get('uuid') == router_id:
            return router
    return None

Security hardening: Added input sanitization to prevent command injection and eliminated stack trace exposure in error responses:

def _sanitize_identifier(self, identifier: str) -> str:
    if not re.match(r'^[a-zA-Z0-9._-]+$', identifier):
        raise ValueError("Invalid identifier format")
    return identifier

All user-provided identifiers, enum values (direction, action, protocol), and numeric ranges (priority) are now validated before use in subprocess commands.

Frontend Fixes

Serve command syntax: Changed from -l 0.0.0.0:3000 to -l tcp://0.0.0.0:3000 in start.sh. The serve package requires explicit protocol specification.

Missing structure: Created required files:

  • public/ directory with HTML template, manifest, favicon
  • src/index.js entry point
  • Page components (Dashboard, LogicalRouters, LoadBalancers, ACLs, Settings)

Added .gitignore to exclude build artifacts and Python cache files.

Original prompt

This section details on the original issue you should resolve

<issue_title>After running - not work</issue_title>
<issue_description>Hi .
Ubuntu 22. Minimal install.
./startx.sh run
Application started successfully!

Available network interfaces:
http://172.16.253.7:3000 (Frontend)
http://172.16.253.7:5000 (Backend API)

But port not listening.
Errors:
backend.log
Traceback (most recent call last):
File "/home/support/ovn-web-manager/backend/app.py", line 9, in
from controllers.logical_router import logical_router_routes
ModuleNotFoundError: No module named 'controllers.logical_router'

frontend.log
support@ovn:~/ovn-web-manager/frontend$ cat frontend.log
file:///home/support/ovn-web-manager/frontend/node_modules/serve/build/main.js:377
throw new Error(
^

Error: Unknown --listen endpoint scheme (protocol): 0.0.0.0:
at parseEndpoint (file:///home/support/ovn-web-manager/frontend/node_modules/serve/build/main.js:377:13)
at type (/home/support/ovn-web-manager/frontend/node_modules/arg/index.js:70:15)
at arg (/home/support/ovn-web-manager/frontend/node_modules/arg/index.js:170:24)
at parseArguments (file:///home/support/ovn-web-manager/frontend/node_modules/serve/build/main.js:414:28)
at file:///home/support/ovn-web-manager/frontend/node_modules/serve/build/main.js:503:40
at ModuleJob.run (node:internal/modules/esm/module_job:195:25)
at async ModuleLoader.import (node:internal/modules/esm/loader:337:24)
at async loadESM (node:internal/process/esm_loader:34:7)
at async handleMainPromise (node:internal/modules/run_main:106:12)

Node.js v18.20.8

</issue_description>

<agent_instructions>Available network interfaces:
http://172.16.253.7:3000 (Frontend)
http://172.16.253.7:5000 (Backend API)

But port not listening.
Errors:
backend.log
Traceback (most recent call last):
File "/home/support/ovn-web-manager/backend/app.py", line 9, in
from controllers.logical_router import logical_router_routes
ModuleNotFoundError: No module named 'controllers.logical_router'

frontend.log
support@ovn:~/ovn-web-manager/frontend$ cat frontend.log
file:///home/support/ovn-web-manager/frontend/node_modules/serve/build/main.js:377
throw new Error(
^

Error: Unknown --listen endpoint scheme (protocol): 0.0.0.0:
at parseEndpoint (file:///home/support/ovn-web-manager/frontend/node_modules/serve/build/main.js:377:13)
at type (/home/support/ovn-web-manager/frontend/node_modules/arg/index.js:70:15)
at arg (/home/support/ovn-web-manager/frontend/node_modules/arg/index.js:170:24)
at parseArguments (file:///home/support/ovn-web-manager/frontend/node_modules/serve/build/main.js:414:28)
at file:///home/support/ovn-web-manager/frontend/node_modules/serve/build/main.js:503:40
at ModuleJob.run (node:internal/modules/esm/module_job:195:25)
at async ModuleLoader.import (node:internal/modules/esm/loader:337:24)
at async loadESM (node:internal/process/esm_loader:34:7)
at async handleMainPromise (node:internal/modules/run_main:106:12)

Node.js v18.20.8</agent_instructions>

Comments on the Issue (you are @copilot in this section)

@bufanoc Hi ygutnik, I just am seeing this now. Give me a few days to get working on this, thank you for your patience. This is by no means a finished or polished application.

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.


Note

Scaffolds the frontend with basic pages and fixes start.sh to use the correct serve listen syntax.

  • Frontend:
    • Scaffold React app: Add public/index.html, public/manifest.json, and entry src/index.js.
    • Pages: Create src/pages/{Dashboard,LogicalRouters,LoadBalancers,ACLs,Settings}.js with a functional Dashboard that fetches counts via api.getLogicalSwitches/getLogicalRouters/getPorts/getACLs and displays stats.
    • Dependencies: Add serve as a dev dependency in package.json.
  • Scripts:
    • start.sh: Fix serve listen flag to -l tcp://0.0.0.0:3000 and retain CORS and logging.

Written by Cursor Bugbot for commit a23b35f. This will update automatically on new commits. Configure here.

Copilot AI self-assigned this Nov 2, 2025
Copilot AI and others added 4 commits November 2, 2025 09:15
Co-authored-by: bufanoc <4837231+bufanoc@users.noreply.github.com>
Co-authored-by: bufanoc <4837231+bufanoc@users.noreply.github.com>
…et commands

Co-authored-by: bufanoc <4837231+bufanoc@users.noreply.github.com>
Co-authored-by: bufanoc <4837231+bufanoc@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix port listening issues in application start script Fix startup failures from missing modules and incorrect serve syntax Nov 2, 2025
Copilot AI requested a review from bufanoc November 2, 2025 09:41
@bufanoc bufanoc requested review from bufanoc and removed request for bufanoc November 6, 2025 07:48
@bufanoc bufanoc marked this pull request as ready for review November 6, 2025 08:06
Copilot AI review requested due to automatic review settings November 6, 2025 08:06
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request adds a comprehensive web interface and backend API for managing Open Virtual Network (OVN) components. It introduces a React frontend with Material-UI, Flask backend with REST API endpoints, and implements security improvements including input sanitization to prevent command injection attacks.

  • Adds frontend pages for Dashboard, Settings, Logical Routers, Load Balancers, and ACLs
  • Implements backend controllers and services for managing OVN resources (switches, routers, ports, ACLs, load balancers)
  • Introduces input validation and sanitization to prevent command injection
  • Updates the start script to use a different serve command syntax

Reviewed Changes

Copilot reviewed 19 out of 22 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
start.sh Updates frontend serve command to use -l tcp:// flag syntax
frontend/package.json Adds serve package as devDependency
frontend/src/pages/*.js Creates placeholder pages for Dashboard, Settings, Routers, Load Balancers, and ACLs
frontend/public/* Adds HTML entry point, manifest, and favicon
backend/services/ovn_client.py Implements OVN client with CRUD operations and security improvements
backend/controllers/*.py Adds REST API controllers for all OVN resources
backend/utils/validators.py Implements input validation functions
.gitignore Adds comprehensive ignore patterns for Python and Node

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +19 to +22
api.getLogicalSwitches(),
api.getLogicalRouters(),
api.getPorts(),
api.getACLs()
Copy link

Copilot AI Nov 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Dashboard component calls methods on the api object (getLogicalSwitches(), getLogicalRouters(), getPorts(), getACLs()) that are not defined in the imported api module. The api module in services/api.js only exports an axios instance without these methods defined. These API methods need to be implemented in the api.js file, or the Dashboard should use direct axios calls like api.get('/logical-switches').

Suggested change
api.getLogicalSwitches(),
api.getLogicalRouters(),
api.getPorts(),
api.getACLs()
api.get('/logical-switches'),
api.get('/logical-routers'),
api.get('/ports'),
api.get('/acls')

Copilot uses AI. Check for mistakes.
routers = ovn_client.get_logical_routers()
return jsonify(routers)
except Exception as e:
return jsonify({"error": "An error occurred processing your request"}), 500
Copy link

Copilot AI Nov 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error message 'An error occurred processing your request' is generic and unhelpful for debugging. Unlike the logical_switch.py controller which returns str(e) to provide specific error details, this controller hides the actual error. Consider returning more specific error information (at least in development mode) to aid troubleshooting.

Copilot uses AI. Check for mistakes.
ports = ovn_client.get_all_ports()
return jsonify(ports)
except Exception as e:
return jsonify({"error": "An error occurred processing your request"}), 500
Copy link

Copilot AI Nov 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error message 'An error occurred processing your request' is generic and unhelpful for debugging. Unlike the logical_switch.py controller which returns str(e) to provide specific error details, this controller hides the actual error. Consider returning more specific error information (at least in development mode) to aid troubleshooting.

Copilot uses AI. Check for mistakes.
Copy link
Owner

@bufanoc bufanoc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merge

@bufanoc bufanoc merged commit 7d5f00f into main Nov 6, 2025
10 of 12 checks passed
@bufanoc bufanoc deleted the copilot/fix-port-listening-issues branch November 25, 2025 15:08
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.

After running - not work

2 participants