{ "info": { "author": "Bhujay Kumar Bhatta", "author_email": "bhujay.bhatta@yahoo.com", "bugtrack_url": null, "classifiers": [], "description": "Inventory of all Widw Area Network links supplied by various Telecom Service Providers. \nFor this project it is assumed that there was a leagacy monolithic application which used to \nserve the purpose of these link inventory management and the inventory data is alrady available in a \npre exising Microsoft SQL database. \n\nThis microservice will first establish connection with the pre-existing database instead of creating one and \nenable rest api to query the data. In future it is expected to provide new features in link inventory \nmanagement and will become independent with its own database. \n\n\n\n\n\ninstall pyodbc - For configuring ubuntu16.04 to connect to MS SQL server you may follow a detial article here \nhttps://wordpress.com/post/bhujaykbhatta.wordpress.com/1339 or follow the section below for a summary\n===========================\n\n\tlsb_release -a\nNo LSB modules are available.\nDistributor ID: Ubuntu\nDescription: Ubuntu 16.04.4 LTS\nRelease: 16.04\nCodename: xenial\n============================================\n\n\tsudo su \n\tcurl https://packages.microsoft.com/keys/microsoft.asc | apt-key add -\n\tcurl https://packages.microsoft.com/config/ubuntu/16.04/prod.list > /etc/apt/sources.list.d/mssql-release.list\n\tsudo apt-get update\n\tsudo ACCEPT_EULA=Y apt-get install msodbcsql17\n\tsudo ACCEPT_EULA=Y apt-get install mssql-tools\n\tsudo apt-get install unixodbc-dev freetds-bin freetds-dev tdsodbc\n\texit\n\t#install pyodbc within virtual environment\n\tpip install pyodbc \n\tpip install mssql-cli\n\t\n\tsudo mv /etc/odbcinst.ini /etc/odbcinst.ini.bak\n\t\n\tsudo vi /etc/odbcinst.ini\n\t\n\t[FreeTDS]\n\tDescription = v0.91 with protocol v7.2\n\tDriver = /usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so\n\tSetup=/usr/lib/i386-linux-gnu/odbc/libtdsS.so\n\tFileUsage = 1\n\tUsageCount = 1\n\t\n\t\n\tsudo vi /etc/freetds/freetds.conf\n \n [global]\n # TDS protocol version\n\t\t; tds version = 4.2\n\n # Whether to write a TDSDUMP file for diagnostic purposes\n # (setting this to /tmp is insecure on a multi-user system)\n\t\t; dump file = /tmp/freetds.log\n\t\t; debug flags = 0xffff\n\n # Command and connection timeouts\n\t\t; timeout = 10\n\t\t; connect timeout = 10\n\n # If you get out-of-memory errors, it may mean that your client\n # is trying to allocate a huge buffer for a TEXT field.\n # Try setting 'text size' to a more reasonable limit\n text size = 64512\n\t\t\n\t\t# A typical Sybase server\n\t\t[egServer50]\n\t\t host = symachine.domain.com\n\t\t port = 5000\n\t\t tds version = 5.0\n\t\t\n\t\t# A typical Microsoft server\n\t\t[egServer70]\n\t\t host = ntmachine.domain.com\n\t\t port = 1433\n\t\t tds version = 7.0\n\t\t# A typical Microsoft server\n\t\t[MSSQL]\n host = dbserver\n port = 1433\n tds version = 7.0\n \n \n sudo vi /etc/odbc.ini\n \n [MSSQL]\n\tDriver = FreeTDS\n\tServerName = MSSQL # maps it to DSN name not the actual host name \n\tPort = 1433\n\tTDS_Version = 7.2\n\t \n \n \n\nInsttall a Microsoft Sql docker container with persistent volume\n\t\n\tsudo docker pull mcr.microsoft.com/mssql/server:2017-latest\n\t#sudo docker run -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=welcome@123' -p 1433:1433 --name sql1 -d mcr.microsoft.com/mssql/server:2017-latest\n \n\nfor data persistance with volume - \n\n sudo docker run -e 'ACCEPT_EULA=Y' -e 'MSSQL_SA_PASSWORD=welcome@123' --name sql1 -p 1433:1433 -v sqlvolume:/var/opt/mssql -d mcr.microsoft.com/mssql/server:2017-latest\n docker volume ls\n \nthe volume is created at the host level by the docker, even if the container is deleted the volume is persisted\nand the next docker run command with -v sqlvolume will mount this existing volume\n\nDRIVER VOLUME NAME\nlocal sqlvolume\n\nfor data persistence with host directory\n\n sudo docker run -e 'ACCEPT_EULA=Y' -e 'MSSQL_SA_PASSWORD=welcome@123' -p 1433:1433 -v :/var/opt/mssql -d mcr.microsoft.com/mssql/server:2017-latest\n\n sudo docker exec -it sql1 \"bash\"\n /opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P 'welcome@123\n CREATE DATABASE infooper\n SELECT Name from sys.Databases\n CREATE LOGIN user1 WITH PASSWORD = 'user@1234';\n CREATE USER user1 FOR LOGIN user1;\n\tGO \n\n GRANT ALL PRIVILEGES ON infooper.* TO 'user1'@'localhost';\n GO\n\nFrom remote computer , pip install mssql-cli or https://github.com/dbcli/mssql-cli/blob/master/doc/installation/linux.md#ubuntu-1604 \nand run the client commands\n\n telnet dbserver 1433\n\n mssql-cli -S 192.168.111.141 -U SA -d infooper -P welcome@123\n CREATE TABLE vw_comm_links (serial_no INT NOT NULL PRIMARY KEY, circuit_id NVARCHAR(50), division_name NVARCHAR(50), fa_end NVARCHAR(50), bandwidth NVARCHAR(50), link_type NVARCHAR(50), )\n INSERT INTO vw_comm_links VALUES (1, 'circuitid1', 'division1', 'faend1', '10MB', 'MPLS' );\n INSERT INTO vw_comm_links VALUES (2, 'circuitid2', 'division2', 'faend2', '5MB', 'PTP' ); \n INSERT INTO vw_comm_links VALUES (3, 'circuitid3', 'division3', 'faend3', '20MB', 'MPLS' );\n GO\n SELECT * FROM vw_comm_links \n GO\n QUIT\n \ntest that tds is working\n\n isql -v MSSQL SA welcome@123\n \n\ninstall the application within a virtual environment\n\n virtualenv -p python3 venv\n source venv/bin/activate\n pip install linkInventory\n \n \nThe main configuration file nfor the application is /etc/tokenleader/linvInventory_configs.yml\n\n\t\tsudo vi /etc/tokenleader/linkInventory_configs.yml\n\t\t\n\t\thost_name: 0.0.0.0 # for docker this should 0.0.0.0\n\t\thost_port: 5004\n\t\tssl: disabled # not required other than testing the flaks own ssl. ssl should be handled by apache\n\t\tssl_settings: adhoc\n\t\tdatabase:\n\t\t DRIVER: '{FreeTDS}'\n\t\t TDS_Verson: 7.0\n\t\t Server: dbserver\n\t\t Port: 1433\n\t\t Database: infooper\n\t\t UID: SA\n\t\t db_pwd_key_map: db_pwd\n\t\t engine_connect_string: 'mssql+pyodbc:///odbc_connect={}'\n\t\t\n\t\tsecrets:\n\t\t secrets_file_location: linkInventory/tests/test_data/secrets.yml # where you have write access\n\t\t fernet_key_location: linkInventory/tests/test_data/fernetkeys # where you have write access and preferebly separated from secrets_file_location\n\t\t db_pwd_key_map: db_pwd # when using encrypt-pwd command use this value for --kemap\n\t\t tokenleader_pwd_key_map: tl_pwd\n\t\t \ngenerated an encrypted password for the db \n\n encrypt-pwd -k db_pwd -p \n \n\nstart the service \n \n linv-start\n \t\n \t\n \n \n\t\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/microservice-tsp-billing/linkInventory", "keywords": "", "license": "Apache Software License", "maintainer": "", "maintainer_email": "", "name": "linkInventory", "package_url": "https://pypi.org/project/linkInventory/", "platform": "", "project_url": "https://pypi.org/project/linkInventory/", "project_urls": { "Homepage": "https://github.com/microservice-tsp-billing/linkInventory" }, "release_url": "https://pypi.org/project/linkInventory/1.2/", "requires_dist": null, "requires_python": "", "summary": "WAN link inventory management ", "version": "1.2" }, "last_serial": 4893850, "releases": { "1.2": [ { "comment_text": "", "digests": { "md5": "95221ba6b08c5bf4c730aea275251663", "sha256": "523f8a79ac1f609bfe37a2039a884c0e08cd54b02bc498be02edafff223cef0c" }, "downloads": -1, "filename": "linkInventory-1.2.tar.gz", "has_sig": false, "md5_digest": "95221ba6b08c5bf4c730aea275251663", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9142, "upload_time": "2019-03-04T10:50:01", "url": "https://files.pythonhosted.org/packages/9f/2a/4eb7c70689e2551ba371b5705738a95ada253ed69a1ab70c0756db8bdbbc/linkInventory-1.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "95221ba6b08c5bf4c730aea275251663", "sha256": "523f8a79ac1f609bfe37a2039a884c0e08cd54b02bc498be02edafff223cef0c" }, "downloads": -1, "filename": "linkInventory-1.2.tar.gz", "has_sig": false, "md5_digest": "95221ba6b08c5bf4c730aea275251663", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9142, "upload_time": "2019-03-04T10:50:01", "url": "https://files.pythonhosted.org/packages/9f/2a/4eb7c70689e2551ba371b5705738a95ada253ed69a1ab70c0756db8bdbbc/linkInventory-1.2.tar.gz" } ] }