Browse Source

FD3-498 DHCP Model para Kea OS. Se agregó asociación entre DHCP y DHCPModel

Guillermo Espinoza 7 years ago
parent
commit
0b1e2dda55

+ 36 - 0
app/DoctrineMigrations/Version20180315120345.php

@@ -0,0 +1,36 @@
+<?php
+
+namespace Application\Migrations;
+
+use Doctrine\DBAL\Migrations\AbstractMigration;
+use Doctrine\DBAL\Schema\Schema;
+
+class Version20180315120345 extends AbstractMigration
+{
+    /**
+     * @param Schema $schema
+     */
+    public function up(Schema $schema)
+    {
+        $extraData = json_encode([
+            'parameters' => [
+                'option122' => true,
+                'remote-ip-maps' => true,
+            ],
+        ]);
+        $this->addsql(
+            "INSERT INTO dhcpmodel (name, extra_data)
+            SELECT * FROM (SELECT 'Kea OS', '{$extraData}') AS tmp
+            WHERE NOT EXISTS (
+                SELECT name FROM dhcpmodel WHERE name = 'Kea OS'
+            ) LIMIT 1;"
+        );
+    }
+
+    /**
+     * @param Schema $schema
+     */
+    public function down(Schema $schema)
+    {
+    }
+}

+ 12 - 12
composer.json

@@ -134,17 +134,17 @@
         "doctrine/orm": "^2.5",
         "dwoo/dwoo": "dev-master",
         "hwi/oauth-bundle": "^0.5.3",
-        "ik/audit-bundle": "v0.1.4",
-        "ik/auth-bundle": "v0.1.4",
-        "ik/base-admin-bundle": "v0.1.4",
-        "ik/device-bundle": "v0.1.4",
-        "ik/extra-data-bundle": "v0.1.4",
-        "ik/migrations-bundle": "v0.1.4",
-        "ik/oauthclient-bundle": "v0.1.4",
-        "ik/owner-voter-bundle": "v0.1.4",
-        "ik/template-bundle": "v0.1.4",
-        "ik/webservice-bundle": "v0.1.4",
-        "ik/workflow-bundle": "v0.1.4",
+        "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/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",
@@ -230,4 +230,4 @@
         ],
         "branch-alias": null
     }
-}
+}

+ 41 - 30
composer.lock

@@ -4,7 +4,7 @@
         "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
         "This file is @generated automatically"
     ],
-    "content-hash": "a33c33be0f9fa051d1731ae0f42a625c",
+    "content-hash": "0e58a04b797c1a40658efb5d40c69568",
     "packages": [
         {
             "name": "behat/transliterator",
@@ -1414,7 +1414,7 @@
         },
         {
             "name": "ik/audit-bundle",
-            "version": "v0.1.2",
+            "version": "dev-master",
             "source": {
                 "type": "git",
                 "url": "ssh://git@200.50.168.30:222/VendorSoftwareFlowdat3/AuditBundle.git",
@@ -1438,11 +1438,11 @@
         },
         {
             "name": "ik/auth-bundle",
-            "version": "v0.1.2",
+            "version": "dev-master",
             "source": {
                 "type": "git",
                 "url": "ssh://git@200.50.168.30:222/VendorSoftwareFlowdat3/AuthBundle.git",
-                "reference": "6355ff9308b0a8e3acb4d50d849ae7fe6df9f137"
+                "reference": "8f28559950fc4e12a96a97084057111fb97156e9"
             },
             "type": "library",
             "autoload": {
@@ -1457,15 +1457,15 @@
                 "auth",
                 "bundle"
             ],
-            "time": "2018-02-19T14:09:39+00:00"
+            "time": "2018-02-19T12:38:29+00:00"
         },
         {
             "name": "ik/base-admin-bundle",
-            "version": "v0.1.2",
+            "version": "dev-master",
             "source": {
                 "type": "git",
                 "url": "ssh://git@200.50.168.30:222/VendorSoftwareFlowdat3/BaseAdmin.git",
-                "reference": "10c4ff5303c45c7f586226ad3a5db8a8a3c5ebb0"
+                "reference": "807fa103f9a0e7d0e22f490de61e1d96645822bc"
             },
             "type": "library",
             "autoload": {
@@ -1480,15 +1480,15 @@
                 "bootstrap",
                 "sonata"
             ],
-            "time": "2018-02-01T14:03:47+00:00"
+            "time": "2018-02-26T17:55:49+00:00"
         },
         {
             "name": "ik/device-bundle",
-            "version": "v0.1.2",
+            "version": "dev-master",
             "source": {
                 "type": "git",
                 "url": "ssh://git@gogs.infra.flowdat.com:222/VendorSoftwareFlowdat3/DeviceBundle.git",
-                "reference": "d50a1db1d54fb7749dbfa8cf7bc8b7c02a578fc4"
+                "reference": "3332f266c84c9b6c9ba8e3bb17fef6aa7d7fdccd"
             },
             "type": "library",
             "autoload": {
@@ -1503,15 +1503,15 @@
                 "bundle",
                 "validators"
             ],
-            "time": "2018-02-19T11:31:32+00:00"
+            "time": "2018-02-19T11:30:09+00:00"
         },
         {
             "name": "ik/extra-data-bundle",
-            "version": "v0.1.2",
+            "version": "dev-master",
             "source": {
                 "type": "git",
                 "url": "ssh://git@200.50.168.30:222/VendorSoftwareFlowdat3/ExtraDataBundle.git",
-                "reference": "78515b49d977a1fddaa7de07e7ab539156a4f7e9"
+                "reference": "06741a4abbe823cc750f3b1d746745a1ab934a60"
             },
             "type": "library",
             "autoload": {
@@ -1526,11 +1526,11 @@
                 "bundle",
                 "extra-data"
             ],
-            "time": "2018-02-19T11:58:38+00:00"
+            "time": "2018-03-15T12:49:20+00:00"
         },
         {
             "name": "ik/migrations-bundle",
-            "version": "v0.1.2",
+            "version": "dev-master",
             "source": {
                 "type": "git",
                 "url": "ssh://git@bitbucket.org/ikflowdat/migrations.git",
@@ -1553,11 +1553,11 @@
         },
         {
             "name": "ik/oauthclient-bundle",
-            "version": "v0.1.2",
+            "version": "dev-master",
             "source": {
                 "type": "git",
                 "url": "ssh://git@200.50.168.30:222/VendorSoftwareFlowdat3/BaseOAuthClientBundle.git",
-                "reference": "e16db4c7d4da6145c06eb395702bae55d2ce4d6b"
+                "reference": "f9ed69669cad8e44d0c82b7233a41dfa41c1328d"
             },
             "require": {
                 "ext-curl": "*",
@@ -1576,15 +1576,15 @@
                 "bundle",
                 "oauth"
             ],
-            "time": "2018-02-19T14:10:27+00:00"
+            "time": "2018-02-19T12:41:13+00:00"
         },
         {
             "name": "ik/owner-voter-bundle",
-            "version": "v0.1.2",
+            "version": "dev-master",
             "source": {
                 "type": "git",
                 "url": "ssh://git@200.50.168.30:222/VendorSoftwareFlowdat3/OwnerVoter.git",
-                "reference": "4d9946aa47c1235d8f523d4ba60cdf4dbceb1954"
+                "reference": "9171fd2335cc3d164a97a27f0531e436ef924701"
             },
             "type": "library",
             "autoload": {
@@ -1599,15 +1599,15 @@
                 "bundle",
                 "owner-voter"
             ],
-            "time": "2018-02-19T14:19:47+00:00"
+            "time": "2018-02-19T13:34:58+00:00"
         },
         {
             "name": "ik/template-bundle",
-            "version": "v0.1.2",
+            "version": "dev-master",
             "source": {
                 "type": "git",
                 "url": "ssh://git@200.50.168.30:222/VendorSoftwareFlowdat3/TemplateBundle.git",
-                "reference": "750b067d24770041a79e2430b45830c2d8c135f1"
+                "reference": "54859222f517480ba9e218092170fcd049472a4d"
             },
             "require": {
                 "ik/base-admin-bundle": "*"
@@ -1625,15 +1625,15 @@
                 "bundle",
                 "template"
             ],
-            "time": "2018-02-19T14:24:16+00:00"
+            "time": "2018-03-14T12:13:59+00:00"
         },
         {
             "name": "ik/webservice-bundle",
-            "version": "v0.1.2",
+            "version": "dev-master",
             "source": {
                 "type": "git",
                 "url": "ssh://git@200.50.168.30:222/VendorSoftwareFlowdat3/Webservice.git",
-                "reference": "910dd69791d03f4f6f9d58a963e28c8bdf87fb51"
+                "reference": "f4c224b26d011c99f789cb4bddf68e1d2cc32645"
             },
             "require": {
                 "ext-curl": "*",
@@ -1646,15 +1646,15 @@
                 }
             },
             "description": "The Flowdat3 Webservice Rest",
-            "time": "2018-02-19T14:30:39+00:00"
+            "time": "2018-02-27T11:03:58+00:00"
         },
         {
             "name": "ik/workflow-bundle",
-            "version": "v0.1.2",
+            "version": "dev-master",
             "source": {
                 "type": "git",
                 "url": "ssh://git@200.50.168.30:222/VendorSoftwareFlowdat3/WorkflowBundle.git",
-                "reference": "f4ba321ba7dd7e7e32daae50cd2d4aeefb9ce8b7"
+                "reference": "9c70562562d4513c38873c958d588f5bedf5fda0"
             },
             "require": {
                 "php-amqplib/rabbitmq-bundle": "^1.12"
@@ -1684,7 +1684,7 @@
                 "bundle",
                 "workflow"
             ],
-            "time": "2018-02-19T14:31:14+00:00"
+            "time": "2018-02-19T13:50:00+00:00"
         },
         {
             "name": "incenteev/composer-parameter-handler",
@@ -6274,6 +6274,17 @@
     "minimum-stability": "stable",
     "stability-flags": {
         "dwoo/dwoo": 20,
+        "ik/audit-bundle": 20,
+        "ik/auth-bundle": 20,
+        "ik/base-admin-bundle": 20,
+        "ik/device-bundle": 20,
+        "ik/extra-data-bundle": 20,
+        "ik/migrations-bundle": 20,
+        "ik/oauthclient-bundle": 20,
+        "ik/owner-voter-bundle": 20,
+        "ik/template-bundle": 20,
+        "ik/webservice-bundle": 20,
+        "ik/workflow-bundle": 20,
         "sonata-project/admin-bundle": 20,
         "voryx/restgeneratorbundle": 20
     },

+ 3 - 0
src/DHCPBundle/Admin/DHCPAdmin.php

@@ -31,6 +31,7 @@ class DHCPAdmin extends BaseAdmin
             ->add('host')
             ->add('user')
             ->add('password')
+            ->add('dhcpModel')
             ->add('extraData')
             ->add('_action', null, array(
                 'actions' => array(
@@ -52,6 +53,7 @@ class DHCPAdmin extends BaseAdmin
             ->add('host')
             ->add('user')
             ->add('password')
+            ->add('dhcpModel')
             ->add('extraData')
         ;
     }
@@ -66,6 +68,7 @@ class DHCPAdmin extends BaseAdmin
             ->add('host')
             ->add('user')
             ->add('password')
+            ->add('dhcpModel')
             ->add('extraData')
         ;
     }

+ 30 - 0
src/DHCPBundle/Entity/DHCP.php

@@ -4,6 +4,7 @@ namespace DHCPBundle\Entity;
 
 use Doctrine\ORM\Mapping as ORM;
 use ExtraDataBundle\Entity\Traits\ExtraDataTrait;
+use JMS\Serializer\Annotation as JMS;
 use Symfony\Component\Validator\Constraints as Assert;
 
 /**
@@ -54,6 +55,14 @@ class DHCP
      */
     private $password;
 
+    /**
+     * @ORM\ManyToOne(targetEntity="DHCPModel", inversedBy="dhcps", fetch="EXTRA_LAZY")
+     * @ORM\JoinColumn(onDelete="SET NULL")
+     *
+     * @JMS\MaxDepth(1)
+     */
+    private $dhcpModel;
+
 
     /**
     * @return string
@@ -168,4 +177,25 @@ class DHCP
     {
         return $this->password;
     }
+
+    /**
+     * @return DHCPModel
+     */
+    public function getDhcpModel()
+    {
+        return $this->dhcpModel;
+    }
+
+    /**
+     * @param DHCPModel $dhcpModel
+     *
+     * @return DHCP
+     */
+    public function setDhcpModel($dhcpModel)
+    {
+        $this->dhcpModel = $dhcpModel;
+
+        return $this;
+    }
+
 }

+ 17 - 0
src/DHCPBundle/Entity/DHCPModel.php

@@ -4,6 +4,7 @@ namespace DHCPBundle\Entity;
 
 use Doctrine\ORM\Mapping as ORM;
 use ExtraDataBundle\Entity\Traits\ExtraDataTrait;
+use JMS\Serializer\Annotation as JMS;
 use Symfony\Component\Validator\Constraints as Assert;
 
 /**
@@ -33,6 +34,13 @@ class DHCPModel
      */
     private $name;
 
+    /**
+     * @ORM\OneToMany(targetEntity="DHCP", mappedBy="dhcpModel", fetch="EXTRA_LAZY")
+     *
+     * @JMS\MaxDepth(2)
+     */
+    private $dhcps;
+
 
     /**
     * @return string
@@ -75,4 +83,13 @@ class DHCPModel
     {
         return $this->name;
     }
+
+    /**
+     * @return array
+     */
+    public function getDhcps()
+    {
+        return $this->dhcps;
+    }
+
 }

+ 1 - 1
src/DHCPBundle/Form/DHCPType.php

@@ -13,7 +13,7 @@ class DHCPType extends AbstractType
      */
     public function buildForm(FormBuilderInterface $builder, array $options)
     {
-        $builder->add('name')->add('host')->add('user')->add('password')->add('extraData');
+        $builder->add('name')->add('host')->add('user')->add('password')->add('extraData')->add('dhcpModel');
     }
 
     /**

+ 5 - 0
src/DHCPBundle/Resources/translations/DHCPBundle.es.yml

@@ -6,6 +6,7 @@ form:
     label_host: Host
     label_user: Usuario
     label_password: Password
+    label_dhcp_model: Modelo DHCP
 
 breadcrumb:
     link_d_h_c_p_list: Listado DHCP
@@ -19,13 +20,17 @@ list:
     label_user: Usuario
     label_password: Password
     label__action: Acciones
+    label_dhcp_model: Modelo DHCP
 
 show:
     label_name: Nombre
     label_host: Host
     label_user: Usuario
     label_password: Password
+    label_dhcp_model: Modelo DHCP
 
 filter:
     label_name: Nombre
     label_host: Host
+
+default: General