Commit 40c731bd authored by Manuel Angel Jimenez Quesada's avatar Manuel Angel Jimenez Quesada
Browse files

Clean code (comments, unused lines...)

parent d9d74bce
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -31,7 +31,6 @@ def test_OsmClient(

    osm_list_reply = osm_client.NsiList(nbi_list_request)
    assert len(osm_list_reply.id) == 0
    #assert osm_list_reply.id == []

    nbi_create_request = CreateRequest()
    nbi_create_request.nst_name = "nst1"
+0 −5
Original line number Diff line number Diff line
@@ -31,11 +31,6 @@ RUN python3 -m pip install --upgrade pip-tools
RUN mkdir -p /var/teraflow/mock_osm_nbi
WORKDIR /var/teraflow/mock_osm_nbi
COPY src/tests/tools/mock_osm_nbi/requirements.in requirements.in
# COPY . .



RUN ls

# Get specific Python packages
RUN pip-compile --quiet --output-file=requirements.txt requirements.in
+11 −15
Original line number Diff line number Diff line
@@ -68,7 +68,6 @@ class OsmNBI(Resource):

        LOGGER.info(str(OSM_NSI))

        #return make_response(jsonify(OSM_NSI), 200)
        return [nsi["id"] for nsi in OSM_NSI]

    def post(self):
@@ -92,19 +91,17 @@ class OsmNBI(Resource):
        }

        OSM_NSI.append(new_nsi)
        #nsi = {}
        #nsi["_Id"]         = json_request["nstId"]
        #nsi["name"]       = json_request["nsiName"]
        #nsi["Description"]       = json_request["nsiDescription"]
        #nsi["vimAccountId"] = json_request["vimAccountId"]

        #if not isinstance(nsi["nstId"], list): abort(400)
        #OSM_NSI[nsi["nstId"]] = nsi

        return make_response(jsonify(new_nsi), 201)


class VimAccounts(Resource):
    """
    Mock -> /osm/admin/v1/vim_accounts
    Support:
      • GET    → get all VIM Account
      • POST   → Create a VIM Account
    """
    def get(self):
        return jsonify(OSM_VIM_DB)

@@ -132,15 +129,15 @@ class VimAccounts(Resource):
class VimAccountItem(Resource):
    """
    Mock -> /osm/admin/v1/vim_accounts/<account_id>
    Soporta:
      • GET    → devuelve la VIM Account concreta
      • PUT    → actualiza campos permitidos
      • DELETE → elimina la cuenta
    Support:
      • GET    → get VIM Account
      • PUT    → Upadate fields
      • DELETE → Delete VIM Account
    """

    @staticmethod
    def _find(account_id):
        """Busca la cuenta por _id en la base in-memory"""
        """Search VIM account"""
        return next(
            (acc for acc in OSM_VIM_DB if acc["_id"] == account_id),
            None
@@ -164,7 +161,6 @@ class VimAccountItem(Resource):
            return {"error": "not found"}, 404

        payload = request.get_json(silent=True) or {}
        # campos actualizables
        for field in ("name", "vim_type", "tenant", "vim_url"):
            if field in payload:
                account[field] = payload[field]