Jelajahi Sumber

Merged master into FD3-450

Luciano Andrade 7 tahun lalu
induk
melakukan
d658f9be7d

+ 16 - 18
.drone.yml

@@ -18,11 +18,12 @@ pipeline:
       HOST_BASE: base.test.fd3.flowdat.com
       HOST_RADIUS: radius.test.fd3.flowdat.com
       HOST_CABLEMODEM: cablemodem.test.fd3.flowdat.com
+      HOST_DUMMY: "http://www.flowdat.com/"
+      HOST_DHCP: dhcp.test.fd3.flowdat.com
       OAUTH_CLIENT_ID: ""
       OAUTH_CLIENT_SECRET: ""
       AMQP_KEY: ""
       CLIENT: fd3
-      HOST_DUMMY: "http://www.flowdat.com/"
     commands:
       - command -v mysqladmin >/dev/null 2>&1 || { echo "I require mysqladmin but it's not installed.  Aborting." >&2; exit 1; }
       - while ! mysqladmin ping -h 127.0.0.1 --silent; do :; done
@@ -35,18 +36,16 @@ pipeline:
 
       - chmod 0400 keys/bitbucket.id_rsa
       - eval $(ssh-agent); ssh-add keys/bitbucket.id_rsa
+      - cp app/config/parameters.yml.dist app/config/parameters.yml
       - cp app/config/bundles/ik/device-bundle/parameters.yml.drone app/config/bundles/ik/device-bundle/parameters.yml
       - cp app/config/bundles/ik/base-admin-bundle/parameters.yml.dist app/config/bundles/ik/base-admin-bundle/parameters.yml
-      - cp app/config/bundles/ik/webservice-bundle/parameters.yml.dist app/config/bundles/ik/webservice-bundle/parameters.yml
-      - chmod 0777 -R var/logs var/cache var/sessions
       - composer install -n --no-progress
       - composer dump-autoload --optimize
+      - chmod 0777 -R var/logs var/cache var/sessions
       - php bin/console doctrine:schema:update --force -vvv --env=test
-      - php bin/console cache:clear --no-warmup
       - touch var/logs/test.log
-
       - tail -f var/logs/*.log &
-      # - bin/console server:run --help --end=prod
+      - bin/console server:run --env=test &
       - vendor/phpunit/phpunit/phpunit -c phpunit.xml.dist
 
  docker:
@@ -54,19 +53,18 @@ pipeline:
    image: plugins/docker
    email: luciano@interlink.com.ar
    registry: docker.infra.flowdat.com
-   tag:
-     - latest
+   tag: latest
    when:
-     event: [pull_request, push, tag]
-     branch: [master]
+     event: [push]
+     branch: master
 
- docker_version:
-   repo : docker.infra.flowdat.com/fd3/cablemodem
-   image: plugins/docker
-   email: luciano@interlink.com.ar
-   registry: docker.infra.flowdat.com
-   tag:
+ docker_tag:
+  repo : docker.infra.flowdat.com/fd3/cablemodem
+  image: plugins/docker
+  email: luciano@interlink.com.ar
+  registry: docker.infra.flowdat.com
+  tag:
      - ${DRONE_TAG##v}
-   when:
-     event: [pull_request, push, tag]
+  when:
+     event: [tag]
      branch: [v*]

+ 0 - 47
app/DoctrineMigrations/Version20180117141124.php

@@ -1,47 +0,0 @@
-<?php
-
-namespace Application\Migrations;
-
-use Doctrine\DBAL\Migrations\AbstractMigration;
-use Doctrine\DBAL\Schema\Schema;
-use Symfony\Component\DependencyInjection\ContainerAwareInterface;
-use Symfony\Component\DependencyInjection\ContainerInterface;
-use Symfony\Component\Process\Process;
-
-/**
- * Migración que corre el comando init:templates:docsis para cargar los modelos y template docsis
- */
-class Version20180117141124 extends AbstractMigration implements ContainerAwareInterface
-{
-
-    /**
-     * @var ContainerInterface
-     */
-    private $container;
-
-    /**
-     * @param ContainerInterface $container
-     */
-    public function setContainer(ContainerInterface $container = null)
-    {
-        $this->container = $container;
-    }
-
-    /**
-     * @param Schema $schema
-     */
-    public function up(Schema $schema)
-    {
-        $consolePath = $this->container->get('kernel')->getRootDir() . '/../bin/console';
-        $process = new Process("{$consolePath} init:templates:docsis");
-        $process->run();
-        $content = $process->getOutput();
-        echo $content;
-    }
-
-    public function down(Schema $schema)
-    {
-
-    }
-
-}

+ 2 - 1
app/config/bundles/ik/webservice-bundle/parameters.yml.dist

@@ -9,11 +9,12 @@ parameters:
     url_dummy: 'http://%env(HOST_DUMMY)%'
     client: '%url_base%/api/clients.json'
     sidebar_menu:
-        FTTH: '%url_ftth%'
         Base: '%url_base%'
+        FTTH: '%url_ftth%'
         Mapas: '%url_mapas%'
         Stats: '%url_stats%'
         DHCP: '%url_dhcp%'
+        Radius: '%url_radius%'
     remote_client_create_url: '%url_base%/admin/client/client/create'
     remote_device_url: '%url_base%/api/devices.json'
     remote_device_log_url: '%url_base%/api/devicelogs.json'

+ 2 - 1
app/config/bundles/ik/webservice-bundle/parameters.yml.docker

@@ -9,11 +9,12 @@ parameters:
     url_dummy: 'http://%env(HOST_DUMMY)%'
     client: '%url_base%/api/clients.json'
     sidebar_menu:
-        FTTH: '%url_ftth%'
         Base: '%url_base%'
+        FTTH: '%url_ftth%'
         Mapas: '%url_mapas%'
         Stats: '%url_stats%'
         DHCP: '%url_dhcp%'
+        Radius: '%url_radius%'
     remote_client_create_url: '%url_base%/admin/client/client/create'
     remote_device_url: '%url_base%/api/devices.json'
     remote_device_log_url: '%url_base%/api/devicelogs.json'

+ 7 - 6
app/config/parameters.yml.dist

@@ -20,18 +20,19 @@ parameters:
 
     jms_serializer.camel_case_naming_strategy.class: JMS\Serializer\Naming\IdenticalPropertyNamingStrategy
 
-    # amqp queue config
-    rabbit_mq.host:     'amqp'
+    # RabbitMQ parameters
+    rabbit_mq.host:     127.0.0.1
     rabbit_mq.port:     5672
     rabbit_mq.user:     'guest'
     rabbit_mq.password: 'guest'
     rabbit_mq.vhost:    '/'
 
-    db_session_host: mysql
-    db_session_port: ~
+    db_session_host: 127.0.0.1
+    db_session_port: null
     db_session_name: fd_session
     db_session_user: root
-    db_session_password: 235r2342gtfsw
+    db_session_password: null
+
     env(HOST_AMQP): amqp
     env(AMQP_KEY): cablemodem
 
@@ -42,4 +43,4 @@ parameters:
     nginx_name: nginx-proxy
 
     # App Dummy URL
-    env(HOST_DUMMY): http://www.flowdat.com/
+    env(HOST_DUMMY): http://www.flowdat.com/

+ 0 - 37
app/config/security.drone.yml

@@ -1,37 +0,0 @@
-security:
-
-    providers:
-        oauth:
-            id: base_oauth_bundle.oauth_user_provider
-
-    role_hierarchy:
-        ROLE_ADMIN: [ROLE_USER, ROLE_ALLOWED_TO_SWITCH]
-        ROLE_SUPER_ADMIN: ROLE_ADMIN
-
-    firewalls:
-        dev:
-            pattern: ^/(_(profiler|wdt)|css|images|js)/
-            security: false
-        secured_area:
-            pattern: ^/
-            logout:
-                path:   /logout
-                target: /
-                success_handler: base_admin.security.logout.handler
-            anonymous: true
-
-            # HWIOAuthBundle + BaseOAuthBundle Configuration
-            oauth:
-                login_path: /login
-                failure_path: /login
-                check_path: /login
-                resource_owners:
-                    login: /login_check
-                oauth_user_provider:
-                    service: base_oauth_bundle.oauth_user_provider
-
-    access_control:
-        - { path: ^/login, roles: IS_AUTHENTICATED_ANONYMOUSLY }
-        - { path: ^/admin/, role: ROLE_ADMIN }
-        - { path: ^/efconnect, role: ROLE_USER }
-        - { path: ^/elfinder, role: ROLE_USER }

+ 9 - 8
app/config/security_test.yml

@@ -9,16 +9,17 @@ security:
         ROLE_SUPER_ADMIN: ROLE_ADMIN
 
     firewalls:
+        api:
+            pattern: ^/api
+            # stateless: true
+            # http_basic: ~
+            anonymous: true
+            security: false
+
         dev:
             pattern: ^/(_(profiler|wdt)|css|images|js)/
             security: false
-        
-        api:
-          pattern: ^/api
-          stateless: true
-          anonymous: true
-          http_basic: ~   
-            
+
         secured_area:
             pattern: ^/
             logout:
@@ -39,4 +40,4 @@ security:
 
     access_control:
         - { path: ^/login, roles: IS_AUTHENTICATED_ANONYMOUSLY }
-        - { path: ^/admin/, role: ROLE_ADMIN }
+        - { path: ^/admin/, role: ROLE_ADMIN }

+ 21 - 19
composer.json

@@ -135,11 +135,25 @@
         "doctrine/instantiator": "^1.0.5",
         "doctrine/orm": "^2.5",
         "hwi/oauth-bundle": "^0.5.3",
+        "ik/audit-bundle": "dev-master",
+        "ik/auth-bundle": "dev-master",
+        "ik/base-admin-bundle": "dev-master",
+        "ik/device-bundle": "dev-master",
+        "ik/extra-data-bundle": "dev-master",
+        "ik/leaflet-bundle": "dev-master",
+        "ik/map-bundle": "dev-master",
+        "ik/migrations-bundle": "dev-master",
+        "ik/oauthclient-bundle": "dev-master",
+        "ik/owner-voter-bundle": "dev-master",
+        "ik/template-bundle": "dev-master",
+        "ik/webservice-bundle": "dev-master",
+        "ik/workflow-bundle": "dev-master",
         "incenteev/composer-parameter-handler": "^2.0",
+        "jdorn/sql-formatter": "^1.2.17",
         "jms/serializer": "^1.9.0",
         "jms/serializer-bundle": "^1.5.0",
-        "jdorn/sql-formatter": "^1.2.17",
         "php-amqplib/rabbitmq-bundle": "^1.12",
+        "phpunit/phpunit": "6.4.3",
         "samsonasik/package-versions": "1.1.0",
         "sensio/distribution-bundle": "^5.0.21",
         "sensio/framework-extra-bundle": "^3.0.2",
@@ -149,31 +163,17 @@
         "swiftmailer/swiftmailer": "^5.4",
         "symfony/assetic-bundle": "^2.8.2",
         "symfony/monolog-bundle": "^3.1.0",
+        "symfony/phpunit-bridge": "v3.3.10",
         "symfony/polyfill-apcu": "^1.0",
         "symfony/swiftmailer-bundle": "^2.3.10",
         "symfony/symfony": "3.3.*",
         "symfony/web-server-bundle": "^3.3",
         "twig/extensions": "^1.5",
         "twig/twig": "^2.0",
-        "voryx/restgeneratorbundle": "dev-master",
-        "ik/audit-bundle": "dev-master",
-        "ik/auth-bundle": "dev-master",
-        "ik/base-admin-bundle": "dev-master",
-        "ik/device-bundle": "dev-master",
-        "ik/extra-data-bundle": "dev-master",
-        "ik/leaflet-bundle": "dev-master",
-        "ik/map-bundle": "dev-master",
-        "ik/migrations-bundle": "dev-master",
-        "ik/oauthclient-bundle": "dev-master",
-        "ik/webservice-bundle": "dev-master",
-        "ik/owner-voter-bundle": "dev-master",
-        "ik/template-bundle": "dev-master",
-        "ik/workflow-bundle": "dev-master"
+        "voryx/restgeneratorbundle": "dev-master"
     },
     "require-dev": {
-        "phpunit/phpunit": "^6.4",
-        "sensio/generator-bundle": "^3.0",
-        "symfony/phpunit-bridge": "^3.3"
+        "sensio/generator-bundle": "^3.0"
     },
     "scripts": {
         "workflows-commands": [
@@ -195,6 +195,7 @@
         "doctrine-update": "php bin/console doctrine:schema:update --force",
         "doctrine-migrations": "php bin/console doctrine:migrations:migrate --no-interaction --allow-no-migration",
         "auto-increment": "php bin/console baseadmin:autoincrement",
+        "init-template-docsis": "php bin/console init:templates:docsis",
         "post-install-cmd": [
             "@workflows-commands",
             "@symfony-scripts",
@@ -202,7 +203,8 @@
             "@chmod-dir-cache-sessions-logs",
             "@doctrine-update",
             "@auto-increment",
-            "@doctrine-migrations"
+            "@doctrine-migrations",
+            "@init-template-docsis"
         ],
         "post-update-cmd": [
             "@workflows-commands",

File diff ditekan karena terlalu besar
+ 2044 - 2045
composer.lock


+ 9 - 7
src/CablemodemBundle/tests/CMTSRESTControllerTest.php

@@ -104,17 +104,16 @@ class CMTSRESTControllerTest extends WebTestCaseBase
      */
     private function generateGET($uri = null, $data = null)
     {
-        $this->initDefault();
         if ($uri == null) {
             $uri = $this->getUri();
         }
         if ($data == null) {
-            $data = [
+            $data = array(
                 'name' => $this->obtainData('name'),
                 'tenancyId' => $this->obtainData('tenancyId'),
-            ];
+            );
         }
-        
+
         $this->getClient()->request('GET', $uri . $this->generateFilters($data));
 
         return $this->getClient()->getResponse();
@@ -141,8 +140,8 @@ class CMTSRESTControllerTest extends WebTestCaseBase
      */
     public function testPOST()
     {
-        // inicializo con los datos del webservicemock
-        $this->initDefault($this->obtainDataWebService());
+        $this->initDefault();
+
         // seteo los datos del listener
         $this->setListener();
         // hago la inserccion llamando al servicio por post
@@ -163,6 +162,7 @@ class CMTSRESTControllerTest extends WebTestCaseBase
     {
         // obtengo la respuesta
         $response = $this->generateGET();
+
         // verifco el resultado
         $this->assertEquals(200, $response->getStatusCode(), "Error en la respuesta http.");
         $this->assertJson($response->getContent(), "No se obtuvo un objeto json.");
@@ -181,8 +181,10 @@ class CMTSRESTControllerTest extends WebTestCaseBase
         $response = $this->generateGET();
         // busco el id
         $id = $this->getProperty($response, 'id');
+
         // inicializo con los datos del webservicemock
-        $this->initDefault($this->obtainDataWebService());
+        $this->initDefault();
+
         // seteo los datos del listener
         $this->setListener();
         // creo el nuevo set de datos a enviar.